[Python-checkins] cpython: Issue #18408: PyObject_Call() now fails with an assertion error in debug mode
victor.stinner
python-checkins at python.org
Tue Jul 16 00:12:49 CEST 2013
http://hg.python.org/cpython/rev/82b2ee140994
changeset: 84641:82b2ee140994
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Jul 15 17:50:07 2013 +0200
summary:
Issue #18408: PyObject_Call() now fails with an assertion error in debug mode
if the function called failed whereas no exception was raised, to detect bugs
earlier.
files:
Objects/abstract.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Objects/abstract.c b/Objects/abstract.c
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2104,10 +2104,16 @@
return NULL;
result = (*call)(func, arg, kw);
Py_LeaveRecursiveCall();
- if (result == NULL && !PyErr_Occurred())
+#ifdef NDEBUG
+ if (result == NULL && !PyErr_Occurred()) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
+ }
+#else
+ if (result == NULL)
+ assert(PyErr_Occurred());
+#endif
return result;
}
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list