forked from premiere/premiere-libtorrent
back-port python3 fix
This commit is contained in:
parent
8007b947fd
commit
1229491e5e
|
@ -51,7 +51,7 @@ struct entry_to_python
|
||||||
list l;
|
list l;
|
||||||
for (std::vector<char>::const_iterator i = pre.begin()
|
for (std::vector<char>::const_iterator i = pre.begin()
|
||||||
, end(pre.end()); i != end; ++i)
|
, end(pre.end()); i != end; ++i)
|
||||||
l.append(*i);
|
l.append(int(*i));
|
||||||
return tuple(l);
|
return tuple(l);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -153,7 +153,7 @@ struct entry_from_python
|
||||||
std::vector<char> preformatted(length);
|
std::vector<char> preformatted(length);
|
||||||
for (std::size_t i = 0; i < length; ++i)
|
for (std::size_t i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
preformatted[i] = extract<char>(t[i]);
|
preformatted[i] = char(extract<int>(t[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry(preformatted);
|
return entry(preformatted);
|
||||||
|
|
|
@ -16,10 +16,11 @@ class test_create_torrent(unittest.TestCase):
|
||||||
ct = lt.create_torrent(ti)
|
ct = lt.create_torrent(ti)
|
||||||
entry = ct.generate()
|
entry = ct.generate()
|
||||||
content = lt.bencode(entry).strip()
|
content = lt.bencode(entry).strip()
|
||||||
with open('unordered.torrent', 'r') as f:
|
with open('unordered.torrent', 'rb') as f:
|
||||||
file_content = f.read().strip()
|
file_content = bytearray(f.read().strip())
|
||||||
print file_content
|
print(content)
|
||||||
print content
|
print(file_content)
|
||||||
|
print(entry)
|
||||||
self.assertEqual(content, file_content)
|
self.assertEqual(content, file_content)
|
||||||
|
|
||||||
class test_torrent_handle(unittest.TestCase):
|
class test_torrent_handle(unittest.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue