diff Python/Python-ast.c @ 84856:ad90fc28769a

Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object().
author Christian Heimes <christian@cheimes.de>
date Sat, 27 Jul 2013 00:33:35 +0200
parents 9d26379db328 65121aa79ab3
children 142c62a490ce
line wrap: on
line diff
--- a/Python/Python-ast.c	Sat Jul 27 00:04:42 2013 +0200
+++ b/Python/Python-ast.c	Sat Jul 27 00:33:35 2013 +0200
@@ -704,9 +704,13 @@
 {
     if (obj == Py_None)
         obj = NULL;
-    if (obj)
-        PyArena_AddPyObject(arena, obj);
-    Py_XINCREF(obj);
+    if (obj) {
+        if (PyArena_AddPyObject(arena, obj) < 0) {
+            *out = NULL;
+            return -1;
+        }
+        Py_INCREF(obj);
+    }
     *out = obj;
     return 0;
 }