Fix codecs end check

There was a bug before Python 3.4 where an extra byte was included
in e.end when the error callback was called.  That hided a bug in
the code.

Fixes build with Python 3.4+
This commit is contained in:
Behdad Esfahbod 2015-04-16 13:31:08 -07:00
parent 4ba27843a9
commit eefeb258ef

View File

@ -52,7 +52,7 @@ class ExtendCodec(codecs.Codec):
def error(self, e):
if isinstance(e, UnicodeDecodeError):
for end in range(e.start + 1, e.end):
for end in range(e.start + 1, e.end + 1):
s = e.object[e.start:end]
if s in self.mapping:
return self.mapping[s], end