[Python-checkins] bpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)

Victor Stinner webhook-mailer at python.org
Mon Jan 13 12:47:07 EST 2020


https://github.com/python/cpython/commit/2b1df4592e1691017414337514c6e378eb639498
commit: 2b1df4592e1691017414337514c6e378eb639498
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-13T18:46:59+01:00
summary:

bpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)

_Py_FinishPendingCalls() now expects a tstate argument, instead of a
runtime argument.

files:
M Include/internal/pycore_ceval.h
M Python/ceval.c
M Python/pylifecycle.c

diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 857fc0b2524fe..2a7c235cfc264 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -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);
diff --git a/Python/ceval.c b/Python/ceval.c
index f780c212c5f23..e8931c88820d5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -585,11 +585,11 @@ make_pending_calls(_PyRuntimeState *runtime)
 }
 
 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);
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 1d9dff4ce80bd..d5d60d0a6d4d9 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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



More information about the Python-checkins mailing list