[issue2517] Error when printing an exception containing a Unicode string

Nick Coghlan report at bugs.python.org
Wed Jun 11 11:32:24 CEST 2008


Nick Coghlan <ncoghlan at gmail.com> added the comment:

As far as I am concerned, the implementation of PyObject_Unicode in
object.c has a bug in it: it should NEVER be retrieving __unicode__ from
the instance object. The implementation of PyObject_Format in abstract.c
shows the correct way to retrieve a pseudo-slot method like __unicode__
from an arbitrary object.

Line 482 in object.c is the offending line:
	func = PyObject_GetAttr(v, unicodestr);

Fix that bug, then add a __unicode__ method back to Exception objects
and you will have the best of both worlds.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2517>
_______________________________________


More information about the Python-bugs-list mailing list