]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Check for errors from _Py_asdl_seq_new()
authorGuido van Rossum <guido@python.org>
Mon, 28 Jan 2019 19:33:28 +0000 (11:33 -0800)
committerGuido van Rossum <guido@python.org>
Mon, 28 Jan 2019 19:33:28 +0000 (11:33 -0800)
Python/ast.c

index 4d59344a4aa48cc6e77320d5b46f665d5b7f4e64..cad82d1d582777cd70f1b27ec4e6458790340511 100644 (file)
@@ -894,6 +894,8 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
                 }
 
                 argtypes = _Py_asdl_seq_new(num, arena);
+                if (!argtypes)
+                    goto out;
 
                 j = 0;
                 for (i = 0; i < NCH(ch); i++) {
@@ -905,8 +907,11 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
                     }
                 }
             }
-            else
+            else {
                 argtypes = _Py_asdl_seq_new(0, arena);
+                if (!argtypes)
+                    goto out;
+            }
 
             ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));
             if (!ret)