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;
|
||||
for (std::vector<char>::const_iterator i = pre.begin()
|
||||
, end(pre.end()); i != end; ++i)
|
||||
l.append(*i);
|
||||
l.append(int(*i));
|
||||
return tuple(l);
|
||||
}
|
||||
default:
|
||||
|
@ -153,7 +153,7 @@ struct entry_from_python
|
|||
std::vector<char> preformatted(length);
|
||||
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);
|
||||
|
|
|
@ -16,10 +16,11 @@ class test_create_torrent(unittest.TestCase):
|
|||
ct = lt.create_torrent(ti)
|
||||
entry = ct.generate()
|
||||
content = lt.bencode(entry).strip()
|
||||
with open('unordered.torrent', 'r') as f:
|
||||
file_content = f.read().strip()
|
||||
print file_content
|
||||
print content
|
||||
with open('unordered.torrent', 'rb') as f:
|
||||
file_content = bytearray(f.read().strip())
|
||||
print(content)
|
||||
print(file_content)
|
||||
print(entry)
|
||||
self.assertEqual(content, file_content)
|
||||
|
||||
class test_torrent_handle(unittest.TestCase):
|
||||
|
|
Loading…
Reference in New Issue