[Python-checkins] cpython: Issue #18408: add more assertions on PyErr_Occurred() in ceval.c to detect bugs
victor.stinner
python-checkins at python.org
Tue Jul 16 02:02:14 CEST 2013
http://hg.python.org/cpython/rev/92a9ccb2a521
changeset: 84648:92a9ccb2a521
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Jul 16 01:02:12 2013 +0200
summary:
Issue #18408: add more assertions on PyErr_Occurred() in ceval.c to detect bugs
earlier
files:
Objects/abstract.c | 3 +--
Python/ceval.c | 4 ++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Objects/abstract.c b/Objects/abstract.c
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2111,8 +2111,7 @@
"NULL result without error in PyObject_Call");
}
#else
- if (result == NULL)
- assert(PyErr_Occurred());
+ assert(result != NULL || PyErr_Occurred());
#endif
return result;
}
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4216,6 +4216,8 @@
READ_TIMESTAMP(*pintr1);
Py_DECREF(func);
}
+ assert((x != NULL && !PyErr_Occurred())
+ || (x == NULL && PyErr_Occurred()));
/* Clear the stack of the function object. Also removes
the arguments in case they weren't consumed already
@@ -4509,6 +4511,8 @@
Py_XDECREF(callargs);
Py_XDECREF(kwdict);
Py_XDECREF(stararg);
+ assert((result != NULL && !PyErr_Occurred())
+ || (result == NULL && PyErr_Occurred()));
return result;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list