[issue17263] crash when tp_dealloc allows other threads

Charles-François Natali report at bugs.python.org
Sat Feb 23 11:55:38 CET 2013


Charles-François Natali added the comment:

> This shouldn't be a problem in Python 3 where Python threads cannot switch
> during shutdown.

What happens if the GIL is relased during shutdown?

Also, I'm a bit worried about this code:
"""
void
PyThreadState_Clear(PyThreadState *tstate)
{
    if (Py_VerboseFlag && tstate->frame != NULL)
        fprintf(stderr,
          "PyThreadState_Clear: warning: thread still has a frame\n");

    Py_CLEAR(tstate->frame);

    Py_CLEAR(tstate->dict);
"""

The TLS dict is deallocated after having cleared the frame, which
could lead to surprises, no?

----------

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


More information about the Python-bugs-list mailing list