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 steve.dower
Recipients Mark.Shannon, eryksun, gvanrossum, paul.moore, serhiy.storchaka, steve.dower, tim.golden, vstinner, zach.ware
Date 2020-11-13.00:50:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This looks like the smallest change I can make to fix it:

diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 0cd5550cfd..9ff740b87b 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -34,7 +34,11 @@ _Py_IsMainInterpreter(PyThreadState* tstate)
 static inline int
 _Py_ThreadCanHandleSignals(PyInterpreterState *interp)
+#ifndef MS_WINDOWS
     return (_Py_IsMainThread() && interp == _PyRuntime.interpreters.main);
+    return (interp == _PyRuntime.interpreters.main);

I'll need Victor(?) to confirm whether checking for the main interpreter is sufficient. We're calling this from a new thread that AFAICT never holds the GIL, and we pass the main interpreter in explicitly (from trip_signal) so this check always succeeds (here, but not necessarily in other places where it is called).
Date User Action Args
2020-11-13 00:50:10steve.dowersetrecipients: + steve.dower, gvanrossum, paul.moore, vstinner, tim.golden, Mark.Shannon, zach.ware, serhiy.storchaka, eryksun
2020-11-13 00:50:10steve.dowersetmessageid: <>
2020-11-13 00:50:10steve.dowerlinkissue42296 messages
2020-11-13 00:50:10steve.dowercreate