diff options
author | Guido van Rossum <guido@python.org> | 2003-04-10 20:29:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-10 20:29:48 (GMT) |
commit | 6b3fffaf990c64ecf6fc1df7e29dba17bda9d419 (patch) | |
tree | 614cc1e1c7548d9c2cddb56042927467817cc771 | |
parent | 594adac0bf9e800997ff967a550c6645d8de14e5 (diff) | |
download | cpython-6b3fffaf990c64ecf6fc1df7e29dba17bda9d419.zip cpython-6b3fffaf990c64ecf6fc1df7e29dba17bda9d419.tar.gz cpython-6b3fffaf990c64ecf6fc1df7e29dba17bda9d419.tar.bz2 |
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.
-rw-r--r-- | Python/errors.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/errors.c b/Python/errors.c index d08c1af..d43501b 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 |