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 arigo
Recipients arigo
Date 2008-07-30.16:38:32
SpamBayes Score 9.063005e-05
Marked as misclassified No
Message-id <1217435914.82.0.412658814842.issue3471@psf.upfronthosting.co.za>
In-reply-to
Content
There is a bunch of obscure behavior caused by the use of
PyObject_GetAttr() to get special method from objects.  This is wrong
because special methods should only be looked up in object types, not on
the objects themselves (i.e. with PyType_Lookup()).

Here is one example caused by the PyObject_GetAttr() found in
PyObject_IsInstance():

import abc
>>> isinstance(5, abc.ABCMeta)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    RuntimeError: maximum recursion depth exceeded while calling a
Python object

This occurs because it ends up trying to call the unbound method
abc.ABCMeta.__instancecheck__(5).  But this first requires checking if
"5" is indeed an instance of abc.ABCMeta... cycle.

Obviously this is just an example; all PyObject_GetAttr() would
potentially need to be reviewed.
History
Date User Action Args
2008-07-30 16:38:36arigosetrecipients: + arigo
2008-07-30 16:38:34arigosetmessageid: <1217435914.82.0.412658814842.issue3471@psf.upfronthosting.co.za>
2008-07-30 16:38:34arigolinkissue3471 messages
2008-07-30 16:38:32arigocreate