STINNER Victor <vstin...@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@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 <rep...@bugs.python.org> <https://bugs.python.org/issue40082> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com