]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40082: trip_signal() uses the main interpreter (GH-19441)
authorVictor Stinner <vstinner@python.org>
Wed, 8 Apr 2020 21:35:05 +0000 (23:35 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Apr 2020 21:35:05 +0000 (23:35 +0200)
commitb54a99d6432de93de85be2b42a63774f8b4581a0
tree59e273ca69f89e6c7eedf91f458ee3cc50eb7cf8
parentcfc3c2f8b34d3864717ab584c5b6c260014ba55a
bpo-40082: trip_signal() uses the main interpreter (GH-19441)

Fix the signal handler: it now always uses the main interpreter,
rather than trying to get the current Python thread state.

The following function now accepts an interpreter, instead of a
Python thread state:

* _PyEval_SignalReceived()
* _Py_ThreadCanHandleSignals()
* _PyEval_AddPendingCall()
* COMPUTE_EVAL_BREAKER()
* SET_GIL_DROP_REQUEST(), RESET_GIL_DROP_REQUEST()
* SIGNAL_PENDING_CALLS(), UNSIGNAL_PENDING_CALLS()
* SIGNAL_PENDING_SIGNALS(), UNSIGNAL_PENDING_SIGNALS()
* SIGNAL_ASYNC_EXC(), UNSIGNAL_ASYNC_EXC()

Py_AddPendingCall() now uses the main interpreter if it fails to the
current Python thread state.

Convert _PyThreadState_GET() and PyInterpreterState_GET_UNSAFE()
macros to static inline functions.
Include/internal/pycore_ceval.h
Include/internal/pycore_pystate.h
Misc/NEWS.d/next/Core and Builtins/2020-04-08-22-33-24.bpo-40082.WI3-lu.rst [new file with mode: 0644]
Modules/signalmodule.c
Python/ceval.c
Python/ceval_gil.h