[Python-checkins] cpython: Issue #23571: Restore removed assert(!PyErr_Occurred()); in

victor.stinner python-checkins at python.org
Mon Mar 16 11:55:32 CET 2015


https://hg.python.org/cpython/rev/91fbe0fff882
changeset:   95007:91fbe0fff882
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Mar 16 11:52:32 2015 +0100
summary:
  Issue #23571: Restore removed assert(!PyErr_Occurred()); in
PyEval_CallObjectWithKeywords()

Sorry Serhiy, I missed your explanation because the review email was moved to
my Spam folder :-(

files:
  Python/ceval.c |  7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4118,6 +4118,13 @@
 {
     PyObject *result;
 
+#ifdef Py_DEBUG
+    /* PyEval_CallObjectWithKeywords() must not be called with an exception
+       set. It raises a new exception if parameters are invalid or if
+       PyTuple_New() fails, and so the original exception is lost. */
+    assert(!PyErr_Occurred());
+#endif
+
     if (arg == NULL) {
         arg = PyTuple_New(0);
         if (arg == NULL)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list