summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-10 20:30:18 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-10 20:30:18 (GMT)
commitef582abab461e306ac3fa0ad867b2db564fed3a5 (patch)
tree790ebf4c78d09a7c794f3c4e27d3a341da8a588e /Python
parentd065a13a96428c8b6cc2809aed9ab2ec08c9d8d5 (diff)
downloadcpython-ef582abab461e306ac3fa0ad867b2db564fed3a5.zip
cpython-ef582abab461e306ac3fa0ad867b2db564fed3a5.tar.gz
cpython-ef582abab461e306ac3fa0ad867b2db564fed3a5.tar.bz2
Backport:
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 13b3d11..224c216 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -131,9 +131,8 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
PyObject *initial_tb = NULL;
if (type == NULL) {
- /* This is a bug. Should never happen. Don't dump core. */
- PyErr_SetString(PyExc_SystemError,
- "PyErr_NormalizeException() called without exception");
+ /* There was no exception, so nothing to do. */
+ return;
}
/* If PyErr_SetNone() was used, the value will have been actually