diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-10-30 14:13:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-30 14:13:17 (GMT) |
commit | 9204fb8623896cc5f68ae350784ee25e8a7b2184 (patch) | |
tree | 2f36a952c747107714dc3ce700eeeabb6f4e6560 /Include | |
parent | 3c09dca4b5de9fe8c8756251d02f49cf093b88c1 (diff) | |
download | cpython-9204fb8623896cc5f68ae350784ee25e8a7b2184.zip cpython-9204fb8623896cc5f68ae350784ee25e8a7b2184.tar.gz cpython-9204fb8623896cc5f68ae350784ee25e8a7b2184.tar.bz2 |
bpo-35081: Cleanup pystate.c and pystate.h (GH-10240)
* Remove _PyThreadState_Current
* Replace GET_TSTATE() with PyThreadState_GET()
* Replace GET_INTERP_STATE() with _PyInterpreterState_GET_UNSAFE()
* Replace direct access to _PyThreadState_Current with
PyThreadState_GET()
* Replace _PyThreadState_Current with
_PyRuntime.gilstate.tstate_current
* Rename SET_TSTATE() to _PyThreadState_SET(), name more
consistent with _PyThreadState_GET()
* Update outdated comments
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pystate.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index 80ee0d1..8860f12 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -208,8 +208,8 @@ typedef struct _ts { * if the thread holds the last reference to the lock, decref'ing the * lock will delete the lock, and that may trigger arbitrary Python code * if there's a weakref, with a callback, to the lock. But by this time - * _PyThreadState_Current is already NULL, so only the simplest of C code - * can be allowed to run (in particular it must not be possible to + * _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest + * of C code can be allowed to run (in particular it must not be possible to * release the GIL). * So instead of holding the lock directly, the tstate holds a weakref to * the lock: that's the value of on_delete_data below. Decref'ing a @@ -307,9 +307,8 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE -# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current # define PyThreadState_GET() \ - ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) + ((PyThreadState*)_Py_atomic_load_relaxed(&_PyRuntime.gilstate.tstate_current)) #else # define PyThreadState_GET() PyThreadState_Get() #endif |