mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
bpo-41690: Use a loop to collect args in the parser instead of recursion (GH-22053)
This program can segfault the parser by stack overflow:
```
import ast
code = "f(" + ",".join(['a' for _ in range(100000)]) + ")"
print("Ready!")
ast.parse(code)
```
the reason is that the rule for arguments has a simple recursion when collecting args:
args[expr_ty]:
[...]
| a=named_expression b=[',' c=args { c }] {
[...] }
This commit is contained in:
parent
3940333637
commit
4a97b1517a
5 changed files with 916 additions and 803 deletions
1668
Parser/parser.c
1668
Parser/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue