diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-18 01:26:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 01:26:04 (GMT) |
commit | 23ef89db7ae46d160650263cc80479c2ed6693fb (patch) | |
tree | 10113d5c3774882bf9f22ad91f863f07e907717f /Python/ceval.c | |
parent | d7fabc116269e4650a684eb04f9ecd84421aa247 (diff) | |
download | cpython-23ef89db7ae46d160650263cc80479c2ed6693fb.zip cpython-23ef89db7ae46d160650263cc80479c2ed6693fb.tar.gz cpython-23ef89db7ae46d160650263cc80479c2ed6693fb.tar.bz2 |
bpo-39984: _PyThreadState_DeleteCurrent() takes tstate (GH-19051)
* _PyThreadState_DeleteCurrent() now takes tstate rather than
runtime.
* Add ensure_tstate_not_null() helper to pystate.c.
* Add _PyEval_ReleaseLock() function.
* _PyThreadState_DeleteCurrent() now calls
_PyEval_ReleaseLock(tstate) and frees PyThreadState memory after
this call, not before.
* PyGILState_Release(): rename "tcur" variable to "tstate".
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b055d61..d4c15f3 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -193,7 +193,8 @@ static void ensure_tstate_not_null(const char *func, PyThreadState *tstate) { if (tstate == NULL) { - _Py_FatalErrorFunc(func, "current thread state is NULL"); + _Py_FatalErrorFunc(func, + "current thread state is NULL (released GIL?)"); } } @@ -314,6 +315,13 @@ PyEval_ReleaseLock(void) } void +_PyEval_ReleaseLock(PyThreadState *tstate) +{ + struct _ceval_runtime_state *ceval = &tstate->interp->runtime->ceval; + drop_gil(ceval, tstate); +} + +void PyEval_AcquireThread(PyThreadState *tstate) { ensure_tstate_not_null(__func__, tstate); |