summaryrefslogtreecommitdiff
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-01-20 11:12:38 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-01-20 11:12:38 +0100
commitbfd316e750bc3040c08d1b5872e2de188e8c1e5f (patch)
treea0f5fc0ce8c171cd2b1f875c33b6089471c07447 /Modules/faulthandler.c
parentaebb6d3682e08c93d8468a9291180c5cbdc2df1b (diff)
downloadcpython-git-bfd316e750bc3040c08d1b5872e2de188e8c1e5f.tar.gz
Add _PyThreadState_UncheckedGet()
Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which gets the current thread state, but don't call Py_FatalError() if it is NULL. Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to no more expose complex and private atomic types. Atomic types depends on the compiler or can even depend on compiler options. The new function _PyThreadState_UncheckedGet() allows to get the variable value without having to care of the exact implementation of atomic types. Changes: * Replace direct usage of the _PyThreadState_Current variable with a call to _PyThreadState_UncheckedGet(). * In pystate.c, replace direct usage of the _PyThreadState_Current variable with the PyThreadState_GET() macro for readability. * Document also PyThreadState_Get() in pystate.h
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 1ed22bf8bc..14384b5d1c 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -490,7 +490,7 @@ faulthandler_thread(void *unused)
assert(st == PY_LOCK_FAILURE);
/* get the thread holding the GIL, NULL if no thread hold the GIL */
- current = (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
+ current = _PyThreadState_UncheckedGet();
_Py_write_noraise(thread.fd, thread.header, (int)thread.header_len);