Fix exception handling in rencode
This commit is contained in:
parent
f6c201f02f
commit
7275cdd3d9
|
@ -163,7 +163,7 @@ def decode_string(x, f):
|
||||||
t = s.decode("utf8")
|
t = s.decode("utf8")
|
||||||
if len(t) != len(s):
|
if len(t) != len(s):
|
||||||
s = t
|
s = t
|
||||||
except UnicodeEncodeError:
|
except UnicodeDecodeError:
|
||||||
pass
|
pass
|
||||||
return (s, colon+n)
|
return (s, colon+n)
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ def make_fixed_length_string_decoders():
|
||||||
t = s.decode("utf8")
|
t = s.decode("utf8")
|
||||||
if len(t) != len(s):
|
if len(t) != len(s):
|
||||||
s = t
|
s = t
|
||||||
except UnicodeEncodeError:
|
except UnicodeDecodeError:
|
||||||
pass
|
pass
|
||||||
return (s, f+1+slen)
|
return (s, f+1+slen)
|
||||||
return f
|
return f
|
||||||
|
|
Loading…
Reference in New Issue