[issue38006] Crash in remove() weak reference callback of weakref.WeakValueDictionary at Python exit

STINNER Victor report at bugs.python.org
Fri Sep 27 17:16:47 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

> If I understand Victor's test case correctly, the problem is caused if you have an extension type that implements tp_traverse but not tp_clear and that there is also a weakref involved in the trash cycle.

I'm not sure that "implements tp_traverse but not tp_clear" is enough to trigger the issue. It's unclear to me neither if it's a good practice or not to implement tp_clear... Since it seems like implementing tp_clear for functions (func_clear) caused this regression... Or maybe it's very specific to the magic combo: weak references with callback.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38006>
_______________________________________


More information about the Python-bugs-list mailing list