]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)
authorVictor Stinner <vstinner@python.org>
Mon, 13 Jan 2020 17:46:59 +0000 (18:46 +0100)
committerGitHub <noreply@github.com>
Mon, 13 Jan 2020 17:46:59 +0000 (18:46 +0100)
_Py_FinishPendingCalls() now expects a tstate argument, instead of a
runtime argument.

Include/internal/pycore_ceval.h
Python/ceval.c
Python/pylifecycle.c

index 857fc0b2524fe8ab3ea7fdf6076cdfb9dd8e9bfc..2a7c235cfc264c5463db9db532c55597598f90f7 100644 (file)
@@ -15,7 +15,7 @@ struct _frame;
 
 #include "pycore_pystate.h"   /* PyInterpreterState.eval_frame */
 
-PyAPI_FUNC(void) _Py_FinishPendingCalls(struct pyruntimestate *runtime);
+PyAPI_FUNC(void) _Py_FinishPendingCalls(PyThreadState *tstate);
 PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
 PyAPI_FUNC(void) _PyEval_FiniThreads(
     struct _ceval_runtime_state *ceval);
index f780c212c5f2380c5f2a4b35cc66ead90a4bf140..e8931c88820d52269dfaa0d76eae0383d57e0ef6 100644 (file)
@@ -585,11 +585,11 @@ error:
 }
 
 void
-_Py_FinishPendingCalls(_PyRuntimeState *runtime)
+_Py_FinishPendingCalls(PyThreadState *tstate)
 {
     assert(PyGILState_Check());
 
-    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+    _PyRuntimeState *runtime = tstate->interp->runtime;
     struct _pending_calls *pending = &runtime->ceval.pending;
 
     PyThread_acquire_lock(pending->lock, WAIT_LOCK);
index 1d9dff4ce80bd25b8a931dd5d0b271c385321850..d5d60d0a6d4d97b179a1308f0c81c8ac7128311b 100644 (file)
@@ -1340,7 +1340,7 @@ Py_FinalizeEx(void)
     wait_for_thread_shutdown(tstate);
 
     // Make any remaining pending calls.
-    _Py_FinishPendingCalls(runtime);
+    _Py_FinishPendingCalls(tstate);
 
     /* The interpreter is still entirely intact at this point, and the
      * exit funcs may be relying on that.  In particular, if some thread