]> granicus.if.org Git - python/commitdiff
Issue #23571: Restore removed assert(!PyErr_Occurred()); in
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 16 Mar 2015 10:52:32 +0000 (11:52 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 16 Mar 2015 10:52:32 +0000 (11:52 +0100)
PyEval_CallObjectWithKeywords()

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

Python/ceval.c

index 1c6089d5c0ec661389ae93b736d24c053cd8cd7f..25fbc0fc79f424a211dccf41c79c39b3b7654a7a 100644 (file)
@@ -4118,6 +4118,13 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
 {
     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)