[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Jan 19 20:56:37 CET 2012
New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:
The script below shows that the error handler is always called with the same error object. The 'start', 'end', and 'reason' properties are correctly updated, but the 'args' is always the same and holds the values used for the first call.
It's a bit weird that error.args[2] is not equal to error.start, for example. All versions are affected: 2.7, 3.2, 3.3.
And by the way, I could not find where these are attributes documented.
def custom_handler(error):
print(error.args,
(error.start, error.end, error.reason))
return b'?'.decode(), error.end
import codecs
codecs.register_error('custom', custom_handler)
b'\x80\xd0'.decode('utf-8', 'custom')
----------
components: Unicode
messages: 151650
nosy: amaury.forgeotdarc, ezio.melotti
priority: normal
severity: normal
status: open
title: codecs error handler is called with a UnicodeDecodeError with the same args
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13830>
_______________________________________
More information about the Python-bugs-list
mailing list