diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-26 21:32:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 21:32:00 (GMT) |
commit | c052b192aaa05eeedb1bd50e0658e2d836ffa581 (patch) | |
tree | e1be65bbf070f16e1299c6542588ff78984fd484 /Include | |
parent | bc515b332bef0eaa3064d3b912ad660932ad8c90 (diff) | |
download | cpython-c052b192aaa05eeedb1bd50e0658e2d836ffa581.zip cpython-c052b192aaa05eeedb1bd50e0658e2d836ffa581.tar.gz cpython-c052b192aaa05eeedb1bd50e0658e2d836ffa581.tar.bz2 |
[3.13] gh-120838: Add _PyThreadState_WHENCE_FINI (gh-121013)
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence().
This change only affects internal API.
(cherry picked from commit a905721b9c5c15279e67c2f7785034b7356b2d46, AKA gh-121010)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/pystate.h | 9 | ||||
-rw-r--r-- | Include/internal/pycore_pystate.h | 6 | ||||
-rw-r--r-- | Include/internal/pycore_tstate.h | 7 |
3 files changed, 10 insertions, 12 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index ed3ee09..bb2af78 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -97,10 +97,11 @@ struct _ts { #ifdef Py_BUILD_CORE # define _PyThreadState_WHENCE_NOTSET -1 # define _PyThreadState_WHENCE_UNKNOWN 0 -# define _PyThreadState_WHENCE_INTERP 1 -# define _PyThreadState_WHENCE_THREADING 2 -# define _PyThreadState_WHENCE_GILSTATE 3 -# define _PyThreadState_WHENCE_EXEC 4 +# define _PyThreadState_WHENCE_INIT 1 +# define _PyThreadState_WHENCE_FINI 2 +# define _PyThreadState_WHENCE_THREADING 3 +# define _PyThreadState_WHENCE_GILSTATE 4 +# define _PyThreadState_WHENCE_EXEC 5 #endif int _whence; diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index a668d78..b0e7252 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -217,10 +217,14 @@ static inline PyInterpreterState* _PyInterpreterState_GET(void) { // PyThreadState functions -extern PyThreadState * _PyThreadState_New( +// Export for _testinternalcapi +PyAPI_FUNC(PyThreadState *) _PyThreadState_New( PyInterpreterState *interp, int whence); extern void _PyThreadState_Bind(PyThreadState *tstate); +PyAPI_FUNC(PyThreadState *) _PyThreadState_NewBound( + PyInterpreterState *interp, + int whence); extern PyThreadState * _PyThreadState_RemoveExcept(PyThreadState *tstate); extern void _PyThreadState_DeleteList(PyThreadState *list); extern void _PyThreadState_ClearMimallocHeaps(PyThreadState *tstate); diff --git a/Include/internal/pycore_tstate.h b/Include/internal/pycore_tstate.h index 733e317..befca95 100644 --- a/Include/internal/pycore_tstate.h +++ b/Include/internal/pycore_tstate.h @@ -14,13 +14,6 @@ extern "C" { #include "pycore_qsbr.h" // struct qsbr -static inline void -_PyThreadState_SetWhence(PyThreadState *tstate, int whence) -{ - tstate->_whence = whence; -} - - // Every PyThreadState is actually allocated as a _PyThreadStateImpl. The // PyThreadState fields are exposed as part of the C API, although most fields // are intended to be private. The _PyThreadStateImpl fields not exposed. |