]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42206: Propagate and raise errors from PyAST_Validate in the parser (GH-23035)
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>
Fri, 30 Oct 2020 11:48:41 +0000 (14:48 +0300)
committerGitHub <noreply@github.com>
Fri, 30 Oct 2020 11:48:41 +0000 (11:48 +0000)
Misc/NEWS.d/next/Core and Builtins/2020-10-30-13-11-01.bpo-42206.xxssR8.rst [new file with mode: 0644]
Parser/pegen.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-10-30-13-11-01.bpo-42206.xxssR8.rst b/Misc/NEWS.d/next/Core and Builtins/2020-10-30-13-11-01.bpo-42206.xxssR8.rst
new file mode 100644 (file)
index 0000000..b9eb135
--- /dev/null
@@ -0,0 +1,2 @@
+Propagate and raise the errors caused by :c:func:`PyAST_Validate` in the
+parser.
index 827d4dace1fc33b26fcc4da45baca6410e4f5304..216edd810e246f2214ac9dcc69380e8061330257 100644 (file)
@@ -1157,7 +1157,9 @@ _PyPegen_run_parser(Parser *p)
         p->start_rule == Py_file_input ||
         p->start_rule == Py_eval_input)
     {
-        assert(PyAST_Validate(res));
+        if (!PyAST_Validate(res)) {
+            return NULL;
+        }
     }
 #endif
     return res;