We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9d6797 commit 7efb1feCopy full SHA for 7efb1fe
bencoder.pyx
@@ -29,18 +29,18 @@ def decode_int(bytes x, int f):
29
f += 1
30
new_f = x.index(b'e', f)
31
n = int(x[f:new_f])
32
- if x[f] == ord('-'):
33
- if x[f + 1] == ord('0'):
+ if x[f] == b'-'[0]:
+ if x[f + 1] == b'0'[0]:
34
raise ValueError()
35
- elif x[f] == ord('0') and new_f != f + 1:
+ elif x[f] == b'0'[0] and new_f != f + 1:
36
37
return n, new_f + 1
38
39
40
def decode_string(bytes x, int f):
41
colon = x.index(b':', f)
42
n = int(x[f:colon])
43
- if x[f] == ord('0') and colon != f + 1:
+ if x[f] == b'0'[0] and colon != f + 1:
44
45
colon += 1
46
return x[colon:colon + n], colon + n
0 commit comments