Skip to content
Prev Previous commit
Next Next commit
put assertion definition under Py_DEBUG to remove Address sanitizer w…
…arning
  • Loading branch information
iritkatriel committed Nov 19, 2021
commit fbff4f6831da24ac08a97749fc808393e482e4f6
4 changes: 4 additions & 0 deletions Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,18 @@ _PyErr_ChainStackItem(_PyErr_StackItem *exc_info)
exc2 = exc_info->exc_type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here could you change 'exc' and 'exc2' to 'type' and 'type2' (or 'typ' and 'typ2')? It drives me nuts that we mix "exc[exption]" and "typ[e]" for the same concept (this must date back to Python 1 when the value was not an exception instance and the exception could be any object).

val2 = exc_info->exc_value;
tb2 = exc_info->exc_traceback;
#ifdef Py_DEBUG
PyObject *exc2_before = exc2;
PyObject *val2_before = val2;
PyObject *tb2_before = tb2;
#endif
_PyErr_NormalizeException(tstate, &exc2, &val2, &tb2);
#ifdef Py_DEBUG
/* exc_info should already be normalized */
assert(exc2 == exc2_before);
assert(val2 == val2_before);
assert(tb2 == tb2_before);
#endif
if (tb2 != NULL) {
PyException_SetTraceback(val2, tb2);
}
Expand Down