[issue40082] Assertion failure in trip_signal

STINNER Victor report at bugs.python.org
Wed Apr 8 13:43:34 EDT 2020


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

Oh oh. This issue is quite annoying for my work on subinterpreters.

I introduced this bug when I moved pending calls from _PyRuntimeState to PyInterpreterState in bpo-39984. _PyEval_AddPendingCall() now requires tstate to add a function to pending calls of the proper interpreter.

The problem on Windows is that each CTRL+c is executed in a different thread. Here is a modified Python 3.8 which dumps the thread identifier ("tid") at startup and when trip_signal() is triggered by CTRL+C:

vstinner at WIN C:\vstinner\python\3.8>python
Running Release|x64 interpreter...
pymain_main: tid=1788
Python 3.8.1+ (heads/3.8-dirty:19be85c765, Apr  8 2020, 19:35:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^C
trip_signal: tid=6996 tstate=0000000000000000
KeyboardInterrupt

>>> ^C
trip_signal: tid=2384 tstate=0000000000000000
KeyboardInterrupt

>>> ^C
trip_signal: tid=32 tstate=0000000000000000
KeyboardInterrupt

When trip_signal() is called, PyGILState_GetThisThreadState() returns NULL.

----------

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


More information about the Python-bugs-list mailing list