[3.9] bpo-41690: Use a loop to collect args in the parser instead of recursion (GH-22053) by pablogsal · Pull Request #22067 · python/cpython
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 34.2k
Conversation
…recursion (pythonGH-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 }] { [...] }. (cherry picked from commit 4a97b15) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters