Skip to content

Commit fbff4f6

Browse files
committed
put assertion definition under Py_DEBUG to remove Address sanitizer warning
1 parent 9275583 commit fbff4f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/errors.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,14 +633,18 @@ _PyErr_ChainStackItem(_PyErr_StackItem *exc_info)
633633
exc2 = exc_info->exc_type;
634634
val2 = exc_info->exc_value;
635635
tb2 = exc_info->exc_traceback;
636+
#ifdef Py_DEBUG
636637
PyObject *exc2_before = exc2;
637638
PyObject *val2_before = val2;
638639
PyObject *tb2_before = tb2;
640+
#endif
639641
_PyErr_NormalizeException(tstate, &exc2, &val2, &tb2);
642+
#ifdef Py_DEBUG
640643
/* exc_info should already be normalized */
641644
assert(exc2 == exc2_before);
642645
assert(val2 == val2_before);
643646
assert(tb2 == tb2_before);
647+
#endif
644648
if (tb2 != NULL) {
645649
PyException_SetTraceback(val2, tb2);
646650
}

0 commit comments

Comments
 (0)