summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-04-12 15:18:16 (GMT)
committerGitHub <noreply@github.com>2019-04-12 15:18:16 (GMT)
commitf13c5c8b9401a9dc19e95d8b420ee100ac022208 (patch)
tree00e61cfbb38d11341b39c3d5abe6b04a2ccbbbb5 /Modules/signalmodule.c
parent44235041f3b957abd36d3792450c3540aa09e120 (diff)
downloadcpython-f13c5c8b9401a9dc19e95d8b420ee100ac022208.zip
cpython-f13c5c8b9401a9dc19e95d8b420ee100ac022208.tar.gz
cpython-f13c5c8b9401a9dc19e95d8b420ee100ac022208.tar.bz2
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-12360)
This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 4590017..962174d 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -19,6 +19,7 @@
#include <process.h>
#endif
#endif
+#include "internal/pycore_pystate.h"
#ifdef HAVE_SIGNAL_H
#include <signal.h>
@@ -295,8 +296,10 @@ trip_signal(int sig_num)
{
/* Py_AddPendingCall() isn't signal-safe, but we
still use it for this exceptional case. */
- Py_AddPendingCall(report_wakeup_send_error,
- (void *)(intptr_t) last_error);
+ _Py_AddPendingCall(_PyRuntime.interpreters.main,
+ main_thread,
+ report_wakeup_send_error,
+ (void *)(intptr_t) last_error);
}
}
}
@@ -313,8 +316,10 @@ trip_signal(int sig_num)
{
/* Py_AddPendingCall() isn't signal-safe, but we
still use it for this exceptional case. */
- Py_AddPendingCall(report_wakeup_write_error,
- (void *)(intptr_t)errno);
+ _Py_AddPendingCall(_PyRuntime.interpreters.main,
+ main_thread,
+ report_wakeup_write_error,
+ (void *)(intptr_t)errno);
}
}
}