Nick Coghlan <[EMAIL PROTECTED]> added the comment:

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.

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to