summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c2
-rw-r--r--Python/sysmodule.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 918f4dffab..0c38f7cf0c 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -161,7 +161,7 @@ PyErr_SetString(PyObject *exception, const char *string)
PyObject *
PyErr_Occurred(void)
{
- PyThreadState *tstate = _PyThreadState_UncheckedGet();
+ PyThreadState *tstate = PyThreadState_GET();
return tstate == NULL ? NULL : tstate->curexc_type;
}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index e348b3873e..9247d4ed69 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1547,8 +1547,9 @@ error:
Py_XDECREF(name);
Py_XDECREF(value);
/* No return value, therefore clear error state if possible */
- if (_PyThreadState_UncheckedGet())
+ if (_PyThreadState_UncheckedGet()) {
PyErr_Clear();
+ }
}
PyObject *