Skip to content

Commit

Permalink
Simplify per-python-version splits in reraise_exc_is_none for readabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
sklam committed Mar 16, 2023
1 parent d5cc2a2 commit 72664d4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions numba/_helperlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,17 +890,10 @@ int reraise_exc_is_none(void) {
PyObject *tb, *type, *value;

#if (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 11)
/* intentionally empty */
#elif (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 7)
PyErr_GetExcInfo(&type, &value, &tb);
#elif (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 8)
PyThreadState *tstate = PyThreadState_GET();
_PyErr_StackItem *tstate_exc = tstate->exc_info;
#else
PyThreadState *tstate_exc = tstate;
#endif

#if (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 11)
PyErr_GetExcInfo(&type, &value, &tb);
#else
type = tstate_exc->exc_type;
value = tstate_exc->exc_value;
tb = tstate_exc->exc_traceback;
Expand Down

0 comments on commit 72664d4

Please sign in to comment.