Eldar Abusalimov added the comment:

It is possible to get a partially initialized class from inside a custom mro(). 
And extending such type results in passing NULL to PySequence_List inside 
mro_implementation, which in turn leads to PyErr_BadInternalCall. #22735 has a 
test reproducing it (http://bugs.python.org/file37036) and a corresponding fix 
of mro_implementation (http://bugs.python.org/file37038).

However, I'm not sure that the proper way is to call PyType_Ready on each 
uninitialized class from tp_bases. In particular, the test case from the link 
above would end up with infinite recursion (PyType_Ready(cls) -> mro(cls) -> 
class X(cls): ... -> PyType_Ready(X) -> PyType_Ready(cls) -> ...). Moreover, 
whether a type is initialized or not is determized by checking its tp_dict, 
which is initialized before filling in tp_mro, so that may be the test above is 
not the case of Roger.

----------
nosy: +abusalimov

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3453>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to