Message70431
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. |
|
Date |
User |
Action |
Args |
2008-07-30 16:38:36 | arigo | set | recipients:
+ arigo |
2008-07-30 16:38:34 | arigo | set | messageid: <1217435914.82.0.412658814842.issue3471@psf.upfronthosting.co.za> |
2008-07-30 16:38:34 | arigo | link | issue3471 messages |
2008-07-30 16:38:32 | arigo | create | |
|