[Python-checkins] cpython: Issue #18408: Fix call_function() of ceval.c to handle PyTuple_New() failure

victor.stinner python-checkins at python.org
Mon Jul 8 22:36:39 CEST 2013


http://hg.python.org/cpython/rev/f4311870e329
changeset:   84513:f4311870e329
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 08 22:27:42 2013 +0200
summary:
  Issue #18408: Fix call_function() of ceval.c to handle PyTuple_New() failure
(in load_args()), ex: MemoryError.

files:
  Python/ceval.c |  13 +++++++++----
  1 files changed, 9 insertions(+), 4 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4171,10 +4171,15 @@
         else {
             PyObject *callargs;
             callargs = load_args(pp_stack, na);
-            READ_TIMESTAMP(*pintr0);
-            C_TRACE(x, PyCFunction_Call(func,callargs,NULL));
-            READ_TIMESTAMP(*pintr1);
-            Py_XDECREF(callargs);
+            if (callargs != NULL) {
+                READ_TIMESTAMP(*pintr0);
+                C_TRACE(x, PyCFunction_Call(func,callargs,NULL));
+                READ_TIMESTAMP(*pintr1);
+                Py_XDECREF(callargs);
+            }
+            else {
+                x = NULL;
+            }
         }
     } else {
         if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) {

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


More information about the Python-checkins mailing list