This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients amaury.forgeotdarc, benjamin.peterson, christoph, davidfraser, georg.brandl, hodgestar, lemburg, ncoghlan, pitrou
Date 2008-06-11.10:02:01
SpamBayes Score 0.0009007928
Marked as misclassified No
Message-id <1213178524.53.0.177493222258.issue2517@psf.upfronthosting.co.za>
In-reply-to
Content
Here's the key difference with the way PyObject_Format looks up the
pseudo-slot method:

		PyObject *method = _PyType_Lookup(Py_TYPE(obj),
						  str__format__);

_PyType_Lookup instead of PyObject_GetAttr - so unicode(Exception) would
only look for type.__unicode__ and avoid getting confused by the utterly
irrelevant Exception.__unicode__ method (which is intended only for
printing Exception instances, not for printing the Exception type itself).

You then need the PyInstance_Check/PyObject_GetAttr special case for
retrieving the bound method because _PyType_Lookup won't work on classic
class instances.
History
Date User Action Args
2008-06-11 10:02:05ncoghlansetspambayes_score: 0.000900793 -> 0.0009007928
recipients: + ncoghlan, lemburg, georg.brandl, amaury.forgeotdarc, davidfraser, pitrou, benjamin.peterson, christoph, hodgestar
2008-06-11 10:02:04ncoghlansetspambayes_score: 0.000900793 -> 0.000900793
messageid: <1213178524.53.0.177493222258.issue2517@psf.upfronthosting.co.za>
2008-06-11 10:02:03ncoghlanlinkissue2517 messages
2008-06-11 10:02:02ncoghlancreate