This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Alexander Riccio, neonene, vstinner
Date 2020-04-08.17:43:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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@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

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

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

When trip_signal() is called, PyGILState_GetThisThreadState() returns NULL.
Date User Action Args
2020-04-08 17:43:34vstinnersetrecipients: + vstinner, Alexander Riccio, neonene
2020-04-08 17:43:34vstinnersetmessageid: <>
2020-04-08 17:43:34vstinnerlinkissue40082 messages
2020-04-08 17:43:34vstinnercreate