Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b3fffa

Browse files
committed
PyErr_NormalizeException(): in the type==NULL test, we should simply
return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case.
1 parent 594adac commit 6b3fffa

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Python/errors.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
131131
PyObject *initial_tb = NULL;
132132

133133
if (type == NULL) {
134-
/* This is a bug. Should never happen. Don't dump core. */
135-
PyErr_SetString(PyExc_SystemError,
136-
"PyErr_NormalizeException() called without exception");
134+
/* There was no exception, so nothing to do. */
135+
return;
137136
}
138137

139138
/* If PyErr_SetNone() was used, the value will have been actually

0 commit comments

Comments
 (0)