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

_Py_FinishPendingCalls() now expects a tstate argument, instead of a
runtime argument.
This commit is contained in:
Victor Stinner 2020-01-13 18:46:59 +01:00 committed by GitHub
parent 3430c55417
commit 2b1df4592e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ struct _frame;
#include "pycore_pystate.h" /* PyInterpreterState.eval_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_Initialize(struct _ceval_runtime_state *);
PyAPI_FUNC(void) _PyEval_FiniThreads( PyAPI_FUNC(void) _PyEval_FiniThreads(
struct _ceval_runtime_state *ceval); struct _ceval_runtime_state *ceval);

View File

@ -585,11 +585,11 @@ error:
} }
void void
_Py_FinishPendingCalls(_PyRuntimeState *runtime) _Py_FinishPendingCalls(PyThreadState *tstate)
{ {
assert(PyGILState_Check()); assert(PyGILState_Check());
PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); _PyRuntimeState *runtime = tstate->interp->runtime;
struct _pending_calls *pending = &runtime->ceval.pending; struct _pending_calls *pending = &runtime->ceval.pending;
PyThread_acquire_lock(pending->lock, WAIT_LOCK); PyThread_acquire_lock(pending->lock, WAIT_LOCK);

View File

@ -1340,7 +1340,7 @@ Py_FinalizeEx(void)
wait_for_thread_shutdown(tstate); wait_for_thread_shutdown(tstate);
// Make any remaining pending calls. // Make any remaining pending calls.
_Py_FinishPendingCalls(runtime); _Py_FinishPendingCalls(tstate);
/* The interpreter is still entirely intact at this point, and the /* The interpreter is still entirely intact at this point, and the
* exit funcs may be relying on that. In particular, if some thread * exit funcs may be relying on that. In particular, if some thread