[Python-checkins] python/dist/src/Objects unicodeobject.c, 2.231, 2.232

Walter Dörwald walter at livinglogic.de
Wed Oct 12 09:40:54 CEST 2005


Am 12.10.2005 um 05:50 schrieb Neal Norwitz:

> I don't have a problem with this checkin, but in reviewing it I
> noticed something.  It seems that the exceptionObject (exc) is
> returned from unicode_decode_call_errorhandler(), but it is never used
> other than calling Py_XDECREF(exc).  It looked like goto onError
> always followed a failure of unicode_decode_call_errorhandler().

It does, but when unicode_decode_call_errorhandler() *doesn't* fail,  
it might be called a second time later on. For performance reasons  
unicode_decode_call_errorhandler() then doesn't create a new  
exception object to be passed to the error handler, but reuses the  
old one (the PEP explicitely allows this).

> Is this the case?  Can exceptionObject be removed?  I didn't look at
> any other parameter to determine if each was necessary.  I didn't
> study it long enough to be sure exc can be removed, but it sure looked
> like it from a moderate inspection.
>
> If we could simplify this code it would be nice.

Yes, but I don't see how.

Bye,
    Walter Dörwald



More information about the Python-checkins mailing list