[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2018-02-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

For reference, this behavior was from beginning, since implementing PEP 293 in 
issue432401.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2018-02-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2012-02-03 Thread STINNER Victor

STINNER Victor  added the comment:

Codec encoders reuse the same exception object for speed, but set some 
attributes (start, end and reason). Recreate the args tuple each time that a 
attribute is set. UnicodeEncodeError and UnicodeDecodeError should maybe 
override args getter to create a new tuple at each call.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2012-02-03 Thread Walter Dörwald

Walter Dörwald  added the comment:

See this ancient posting about this problem:

   http://mail.python.org/pipermail/python-dev/2002-August/027661.html

(see point 4.). So I guess somebody did finally complain! ;)

The error attributes are documented in PEP 293. The existence of the attributes 
is documented in Doc/c-api/exceptions.rst, but not their meaning.

--
nosy: +doerwalter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2012-02-03 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +haypo, lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2012-01-19 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com