summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-03-09 16:16:45 (GMT)
committerGuido van Rossum <guido@python.org>1999-03-09 16:16:45 (GMT)
commiteb894ebd0adf603efaa1b339bf6403de3850d8ff (patch)
tree0ac0e00288930fc6a5885a23ae3bc7e8f05f2667 /Python/ceval.c
parentd3eb5774ad18683aff2a7316242914459e422e26 (diff)
downloadcpython-eb894ebd0adf603efaa1b339bf6403de3850d8ff.zip
cpython-eb894ebd0adf603efaa1b339bf6403de3850d8ff.tar.gz
cpython-eb894ebd0adf603efaa1b339bf6403de3850d8ff.tar.bz2
Always test for an error return (usually NULL or -1) without setting
an exception.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index f52eb0e..ef5bced 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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",