[issue26906] format(object.__reduce__) fails intermittently

Serhiy Storchaka report at bugs.python.org
Fri May 6 16:09:08 EDT 2016


Serhiy Storchaka added the comment:

There is one test (ClassPropertiesAndMethods.test_mutable_bases_with_failing_mro in test_descr) that crashes with the code from issue551412 because _PyType_Lookup() is recursive called from PyType_Ready(). Is this the reason? My patch prevents recursive calls.

Here is minimal example (for Python 3):

class M(type):
    def mro(self):
        hasattr(self, 'foo')
        return type.mro(self)

class C(metaclass=M):
    pass

When class C is created, C.mro() is called while C still is not ready. Resolving an attribute calls _PyType_Lookup() which calls PyType_Ready() which calls mro() etc.

----------
keywords:  -patch

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


More information about the Python-bugs-list mailing list