diff Python/ceval.c @ 84648:92a9ccb2a521

Issue #18408: add more assertions on PyErr_Occurred() in ceval.c to detect bugs earlier
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 16 Jul 2013 01:02:12 +0200
parents 71a572a516f9
children 48a869a39e2d
line wrap: on
line diff
--- a/Python/ceval.c	Tue Jul 16 00:32:14 2013 +0200
+++ b/Python/ceval.c	Tue Jul 16 01:02:12 2013 +0200
@@ -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;
 }