diff options
author | Victor Stinner <vstinner@python.org> | 2023-10-03 16:53:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-03 16:53:51 (GMT) |
commit | d73501602f863a54c872ce103cd3fa119e38bac9 (patch) | |
tree | df6d23aa36d385215bb03f22fe0aacf625bbdf1e /Include | |
parent | 6ab6040054e5ca2d3eb7833dc8bf4eb0bbaa0aac (diff) | |
download | cpython-d73501602f863a54c872ce103cd3fa119e38bac9.zip cpython-d73501602f863a54c872ce103cd3fa119e38bac9.tar.gz cpython-d73501602f863a54c872ce103cd3fa119e38bac9.tar.bz2 |
gh-108867: Add PyThreadState_GetUnchecked() function (#108870)
Add PyThreadState_GetUnchecked() function: similar to
PyThreadState_Get(), but don't issue a fatal error if it is NULL. The
caller is responsible to check if the result is NULL. Previously,
this function was private and known as _PyThreadState_UncheckedGet().
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/object.h | 2 | ||||
-rw-r--r-- | Include/cpython/pystate.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_pystate.h | 2 | ||||
-rw-r--r-- | Include/pystate.h | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 3838f19..ede394d 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -425,7 +425,7 @@ PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc); /* If "cond" is false, then _tstate remains NULL and the deallocator \ * is run normally without involving the trashcan */ \ if (cond) { \ - _tstate = _PyThreadState_UncheckedGet(); \ + _tstate = PyThreadState_GetUnchecked(); \ if (_PyTrash_begin(_tstate, _PyObject_CAST(op))) { \ break; \ } \ diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index af5cc4a..8fd0624 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -218,7 +218,7 @@ struct _ts { /* Similar to PyThreadState_Get(), but don't issue a fatal error * if it is NULL. */ -PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); +PyAPI_FUNC(PyThreadState *) PyThreadState_GetUnchecked(void); // Disable tracing and profiling. diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 5f8b576..a60d949 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -93,7 +93,7 @@ PyAPI_FUNC(PyThreadState *) _PyThreadState_GetCurrent(void); The caller must hold the GIL. - See also PyThreadState_Get() and _PyThreadState_UncheckedGet(). */ + See also PyThreadState_Get() and PyThreadState_GetUnchecked(). */ static inline PyThreadState* _PyThreadState_GET(void) { diff --git a/Include/pystate.h b/Include/pystate.h index e6b4de97..727b8fb 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -56,7 +56,7 @@ PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); The caller must hold the GIL. - See also _PyThreadState_UncheckedGet() and _PyThreadState_GET(). */ + See also PyThreadState_GetUnchecked() and _PyThreadState_GET(). */ PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); // Alias to PyThreadState_Get() |