Fix bdecode of negative number

Closes #162.
This commit is contained in:
Tim Pope 2014-06-17 22:35:21 -04:00
parent 83a317c10b
commit 2cbaacf0d0

View File

@ -49,12 +49,12 @@ def bdecode(f, char=None):
key = bdecode(f, char)
d[key] = bdecode(f)
elif char == 'i':
i = 0
i = ''
while True:
char = f.read(1)
if char == 'e':
return i
i = 10 * i + int(char)
return int(i)
i += char
elif char.isdigit():
i = int(char)
while True: