[issue32758] Stack overflow when parse long expression to AST

Terry J. Reedy report at bugs.python.org
Sun Feb 11 14:25:22 EST 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

If ast_parse returns, a correct tree (A) rather than a buggy tree is a hard requirement.  If ast_parse does not return,  an exception (B) rather than a crash is strongly desired.  We should not risk A to get B.  I presume that Serhiy is suggesting that option 1 either has such a risk or would consume developer resources that might be better spent on other improvements.

For Python, option 2, seems pretty useless for real code because there are much better ways to sum a long sequence: sum(iterable_of_numbers),  seq.append, ''.join(iterable_of_string).

Possible addition to the ast.parse entry.
"Syntactically correct but extremely long or complex source strings may result in a RecursionError or program crash."

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32758>
_______________________________________


More information about the Python-bugs-list mailing list