Author vstinner
Recipients Alexander Riccio, neonene, vstinner
Date 2020-04-08.17:43:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586367814.69.0.112164698898.issue40082@roundup.psfhosted.org>
In-reply-to
Content
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
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.
History
Date User Action Args
2020-04-08 17:43:34vstinnersetrecipients: + vstinner, Alexander Riccio, neonene
2020-04-08 17:43:34vstinnersetmessageid: <1586367814.69.0.112164698898.issue40082@roundup.psfhosted.org>
2020-04-08 17:43:34vstinnerlinkissue40082 messages
2020-04-08 17:43:34vstinnercreate