diff Python/errors.c @ 28571:5fbdcaef9dda legacy-trunk

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.
author Guido van Rossum <guido@python.org>
date Thu, 10 Apr 2003 20:29:48 +0000
parents e07b21ea3c45
children 72cbc41ccc2f
line wrap: on
line diff
--- a/Python/errors.c	Thu Apr 10 17:16:15 2003 +0000
+++ b/Python/errors.c	Thu Apr 10 20:29:48 2003 +0000
@@ -131,9 +131,8 @@
 	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