[issue8627] Unchecked PyErr_WarnPy3k return value in Objects/typeobject.c

Nick Coghlan report at bugs.python.org
Thu May 6 00:07:40 CEST 2010


Nick Coghlan <ncoghlan at gmail.com> added the comment:

I haven't looked at this in a while, but I do remember it was hard to get working at all without a ridiculous number of false alarms - type initialisation isn't the most straightforward thing in the world.

Agreed the warning for __cmp__ should just go away - I think we nuked the actual check in 3.1 when __cmp__ was removed, but must have missed this at the time.

For the refleak, I'm wondering if you may be seeing a problem with statically allocated type objects. type_new does a DECREF on the allocated object if PyType_Ready fails, so everything should be getting cleaned up at that point, but that won't happen for a statically allocated type.

Looking at type_clear, I suggest sticking a "Py_CLEAR(type->tp_mro);" in before the goto error line and see if that eliminates the leak. If that actually works, then I'll have my doubts about the correctness of the other "goto error" lines in PyType_Ready that happen after the call to mro_internal().

----------

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


More information about the Python-bugs-list mailing list