Skip to content

Commit 1dba3d3

Browse files
committed
Use a more correct and specific CPython internals guard in __Pyx_Raise().
See cython#5238 (comment)
1 parent b24286d commit 1dba3d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Cython/Utility/Exceptions.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,20 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
301301
PyErr_SetObject(type, value);
302302

303303
if (tb) {
304-
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
305-
PyObject *tmp_type, *tmp_value, *tmp_tb;
306-
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
307-
Py_INCREF(tb);
308-
PyErr_Restore(tmp_type, tmp_value, tb);
309-
Py_XDECREF(tmp_tb);
310-
#else
304+
#if CYTHON_FAST_THREAD_STATE
311305
PyThreadState *tstate = __Pyx_PyThreadState_Current;
312306
PyObject* tmp_tb = tstate->curexc_traceback;
313307
if (tb != tmp_tb) {
314308
Py_INCREF(tb);
315309
tstate->curexc_traceback = tb;
316310
Py_XDECREF(tmp_tb);
317311
}
312+
#else
313+
PyObject *tmp_type, *tmp_value, *tmp_tb;
314+
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
315+
Py_INCREF(tb);
316+
PyErr_Restore(tmp_type, tmp_value, tb);
317+
Py_XDECREF(tmp_tb);
318318
#endif
319319
}
320320

0 commit comments

Comments
 (0)