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:
Pablo Galindo 2020-09-02 17:44:19 +01:00 committed by GitHub
parent 3940333637
commit 4a97b1517a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 916 additions and 803 deletions

File diff suppressed because it is too large Load diff