[Python-Dev] [Python-checkins] cpython: Close #17828: better handling of codec errors

Nick Coghlan ncoghlan at gmail.com
Wed Nov 13 17:12:30 CET 2013


On 14 November 2013 00:30, Walter Dörwald <walter at livinglogic.de> wrote:
> On 13.11.13 14:51, nick.coghlan wrote:
>
>> http://hg.python.org/cpython/rev/854a2cea31b9
>> changeset:   87084:854a2cea31b9
>> user:        Nick Coghlan <ncoghlan at gmail.com>
>> date:        Wed Nov 13 23:49:21 2013 +1000
>> summary:
>>    Close #17828: better handling of codec errors
>>
>> - output type errors now redirect users to the type-neutral
>>    convenience functions in the codecs module
>> - stateless errors that occur during encoding and decoding
>>    will now be automatically wrapped in exceptions that give
>>    the name of the codec involved
>
>
> Wouldn't it be better to add an annotation API to the exceptions classes?
> This would allow to annotate all exceptions without having to replace the
> exception object.

There's a reason the C API for this is private - it's a band aid fix,
because solving it properly is hard :)

http://bugs.python.org/issue18861 covers the fact this is just one
instance of a broader category of related problems related to
providing good exception context information (and the issue started
with a different one).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list