[issue42296] Infinite loop uninterruptable on Windows in 3.10
Steve Dower
report at bugs.python.org
Thu Nov 12 19:50:10 EST 2020
Steve Dower <steve.dower at python.org> added the comment:
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);
+#else
+ return (interp == _PyRuntime.interpreters.main);
+#endif
}
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).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42296>
_______________________________________
More information about the Python-bugs-list
mailing list