2121#include <process.h>
2222#endif
2323#endif
24+ #include "internal/pycore_pystate.h"
2425
2526#ifdef HAVE_SIGNAL_H
2627#include <signal.h>
@@ -259,6 +260,7 @@ trip_signal(int sig_num)
259260 /* Notify ceval.c */
260261 _PyRuntimeState * runtime = & _PyRuntime ;
261262 PyThreadState * tstate = _PyRuntimeState_GetThreadState (runtime );
263+ PyInterpreterState * interp = runtime -> interpreters .main ;
262264 _PyEval_SignalReceived (& runtime -> ceval );
263265
264266 /* And then write to the wakeup fd *after* setting all the globals and
@@ -299,7 +301,10 @@ trip_signal(int sig_num)
299301 {
300302 /* Py_AddPendingCall() isn't signal-safe, but we
301303 still use it for this exceptional case. */
302- _PyEval_AddPendingCall (tstate , & runtime -> ceval ,
304+ _PyEval_AddPendingCall (tstate ,
305+ & runtime -> ceval ,
306+ & interp -> ceval ,
307+ runtime -> main_thread ,
303308 report_wakeup_send_error ,
304309 (void * )(intptr_t ) last_error );
305310 }
@@ -318,7 +323,10 @@ trip_signal(int sig_num)
318323 {
319324 /* Py_AddPendingCall() isn't signal-safe, but we
320325 still use it for this exceptional case. */
321- _PyEval_AddPendingCall (tstate , & runtime -> ceval ,
326+ _PyEval_AddPendingCall (tstate ,
327+ & runtime -> ceval ,
328+ & interp -> ceval ,
329+ runtime -> main_thread ,
322330 report_wakeup_write_error ,
323331 (void * )(intptr_t )errno );
324332 }
0 commit comments