diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-10-30 11:48:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 11:48:41 (GMT) |
commit | 3af4b585527743e455145d294049c46b7c823ed9 (patch) | |
tree | 7168b564b07fbc6700298a075a06a7c3491bd98f | |
parent | d6238ba82d07e8e0783b692f37dc4b7c8617294b (diff) | |
download | cpython-3af4b585527743e455145d294049c46b7c823ed9.zip cpython-3af4b585527743e455145d294049c46b7c823ed9.tar.gz cpython-3af4b585527743e455145d294049c46b7c823ed9.tar.bz2 |
bpo-42206: Propagate and raise errors from PyAST_Validate in the parser (GH-23035)
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2020-10-30-13-11-01.bpo-42206.xxssR8.rst | 2 | ||||
-rw-r--r-- | Parser/pegen.c | 4 |
2 files changed, 5 insertions, 1 deletions
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 index 0000000..b9eb135 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-10-30-13-11-01.bpo-42206.xxssR8.rst @@ -0,0 +1,2 @@ +Propagate and raise the errors caused by :c:func:`PyAST_Validate` in the +parser. diff --git a/Parser/pegen.c b/Parser/pegen.c index 827d4da..216edd8 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -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; |