From 1fb697b48b9b65379577a9261d04b68af3717bb6 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 27 Aug 2016 20:31:46 +0200 Subject: [PATCH] avoid python3 compile errors in python2 only code (shows up during install) --- ox/torrent/bencode.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ox/torrent/bencode.py b/ox/torrent/bencode.py index 4525468..b586001 100644 --- a/ox/torrent/bencode.py +++ b/ox/torrent/bencode.py @@ -1,5 +1,6 @@ # Written by Petru Paler, Uoti Urpala, Ross Cohen and John Hoffman # see LICENSE.txt for license information +from __future__ import print_function from types import IntType, LongType, StringType, ListType, TupleType, DictType try: @@ -102,10 +103,10 @@ def test_bdecode(): assert 0 except ValueError: pass - assert bdecode('i4e') == 4L - assert bdecode('i0e') == 0L - assert bdecode('i123456789e') == 123456789L - assert bdecode('i-10e') == -10L + assert bdecode('i4e') == 4 + assert bdecode('i0e') == 0 + assert bdecode('i123456789e') == 123456789 + assert bdecode('i-10e') == -10 try: bdecode('i-0e') assert 0 @@ -287,7 +288,7 @@ def bencode(x): try: encode_func[type(x)](x, r) except: - print "*** error *** could not encode type %s (value: %s)" % (type(x), x) + print("*** error *** could not encode type %s (value: %s)" % (type(x), x)) assert 0 return ''.join(r) @@ -295,7 +296,7 @@ def test_bencode(): assert bencode(4) == 'i4e' assert bencode(0) == 'i0e' assert bencode(-10) == 'i-10e' - assert bencode(12345678901234567890L) == 'i12345678901234567890e' + assert bencode(12345678901234567890) == 'i12345678901234567890e' assert bencode('') == '0:' assert bencode('abc') == '3:abc' assert bencode('1234567890') == '10:1234567890'