summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 7b67566727..5ff1e4c81a 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -152,13 +152,7 @@ PyErr_SetString(PyObject *exception, const char *string)
PyObject *
PyErr_Occurred(void)
{
- /* If there is no thread state, PyThreadState_GET calls
- Py_FatalError, which calls PyErr_Occurred. To avoid the
- resulting infinite loop, we inline PyThreadState_GET here and
- treat no thread as no error. */
- PyThreadState *tstate =
- ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current));
-
+ PyThreadState *tstate = _PyThreadState_UncheckedGet();
return tstate == NULL ? NULL : tstate->curexc_type;
}