[issue40789] C-level destructor in PySide2 breaks gen_send_ex, which assumes it's safe to call Py_DECREF with a live exception

Nathaniel Smith report at bugs.python.org
Thu May 28 03:51:18 EDT 2020


Nathaniel Smith <njs at pobox.com> added the comment:

I don't think I understand what you mean by "reentrant"... we don't have any single piece of code that's calling back into itself. The question is about what the tp_dealloc contract is.

Digging into it more, it looks like the standard is for typeobject.c:slot_tp_finalize to save/restore exceptions when invoking Python-level __del__ methods, rather than it being the responsibility of the tp_dealloc or tp_finalizer caller. (And finding that code also answers my next question, which was going to be whether there are any other dance steps you have to do when re-entering CPython from a tp_dealloc!)

So I guess this is a PySide2 bug.

----------

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


More information about the Python-bugs-list mailing list