]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Always test for an error return (usually NULL or -1) without setting
authorGuido van Rossum <guido@python.org>
Tue, 9 Mar 1999 16:16:45 +0000 (16:16 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 9 Mar 1999 16:16:45 +0000 (16:16 +0000)
an exception.

Python/ceval.c

index f52eb0e88ab864b1dce90f6100f44a62bdd524e2..ef5bced21195cd7e6be884f38fc7634e2b7d6a45 100644 (file)
@@ -1723,6 +1723,7 @@ eval_code2(co, globals, locals,
                if (why == WHY_NOT) {
                        if (err == 0 && x != NULL) {
 #ifdef CHECKEXC
+                               /* This check is expensive! */
                                if (PyErr_Occurred())
                                        fprintf(stderr,
                                                "XXX undetected error\n");
@@ -1735,18 +1736,18 @@ eval_code2(co, globals, locals,
                        err = 0;
                }
 
-#ifdef CHECKEXC
                /* Double-check exception status */
                
                if (why == WHY_EXCEPTION || why == WHY_RERAISE) {
                        if (!PyErr_Occurred()) {
-                               fprintf(stderr, "XXX ghost error\n");
                                PyErr_SetString(PyExc_SystemError,
-                                               "ghost error");
+                                       "error return without exception set");
                                why = WHY_EXCEPTION;
                        }
                }
+#ifdef CHECKEXC
                else {
+                       /* This check is expensive! */
                        if (PyErr_Occurred()) {
                                fprintf(stderr,
                                        "XXX undetected error (why=%d)\n",