It seems like _PyThreadState_UncheckedGet() is not inlined as expected, even
when using gcc -O3.
Let's just hope that no exception occurs then... This must be
_PyThreadState_Current and not PyThreadState_GET() because in debug
mode, the latter complains if tstate is NULL. */
- tstate = _PyThreadState_UncheckedGet();
+ tstate = PyThreadState_GET();
if (tstate != NULL && tstate->curexc_type != NULL) {
/* preserve the existing exception */
PyObject *err_type, *err_value, *err_tb;
PyObject *
PyErr_Occurred(void)
{
- PyThreadState *tstate = _PyThreadState_UncheckedGet();
+ PyThreadState *tstate = PyThreadState_GET();
return tstate == NULL ? NULL : tstate->curexc_type;
}
Py_XDECREF(name);
Py_XDECREF(value);
/* No return value, therefore clear error state if possible */
- if (_PyThreadState_UncheckedGet())
+ if (_PyThreadState_UncheckedGet()) {
PyErr_Clear();
+ }
}
PyObject *