summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-19 01:41:21 (GMT)
committerGitHub <noreply@github.com>2020-03-19 01:41:21 (GMT)
commit50e6e991781db761c496561a995541ca8d83ff87 (patch)
tree3380890960438581d8262ad24e2c8b346d664c87 /Include
parent3cde88439d542ed8ca6395acc8dfffd174ecca18 (diff)
downloadcpython-50e6e991781db761c496561a995541ca8d83ff87.zip
cpython-50e6e991781db761c496561a995541ca8d83ff87.tar.gz
cpython-50e6e991781db761c496561a995541ca8d83ff87.tar.bz2
bpo-39984: Move pending calls to PyInterpreterState (GH-19066)
If Py_AddPendingCall() is called in a subinterpreter, the function is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls. * Move pending and eval_breaker fields from _PyRuntimeState.ceval to PyInterpreterState.ceval. * new_interpreter() now calls _PyEval_InitThreads() to create pending calls lock. * Fix Py_AddPendingCall() for subinterpreters. It now calls _PyThreadState_GET() which works in a subinterpreter if the caller holds the GIL, and only falls back on PyGILState_GetThisThreadState() if _PyThreadState_GET() returns NULL.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_pystate.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 0e3a9e6..92eeac7 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -35,12 +35,8 @@ struct _pending_calls {
struct _ceval_runtime_state {
int recursion_limit;
- /* This single variable consolidates all requests to break out of
- the fast path in the eval loop. */
- _Py_atomic_int eval_breaker;
/* Request for dropping the GIL */
_Py_atomic_int gil_drop_request;
- struct _pending_calls pending;
/* Request for checking signals. */
_Py_atomic_int signals_pending;
struct _gil_runtime_state gil;
@@ -53,6 +49,10 @@ struct _ceval_state {
c_tracefunc. This speeds up the if statement in
_PyEval_EvalFrameDefault() after fast_next_opcode. */
int tracing_possible;
+ /* This single variable consolidates all requests to break out of
+ the fast path in the eval loop. */
+ _Py_atomic_int eval_breaker;
+ struct _pending_calls pending;
};
/* interpreter state */