[issue3971] s_push: parser stack overflow MemoryError

ait report at bugs.python.org
Mon Jun 25 05:12:45 EDT 2018


ait <roman.fiedler at ait.ac.at> added the comment:

Also affected, a code generator produced deeply nested code with the structure depicted below and then crashed:

#!/usr/bin/python2 -BEsStt
A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A([A(None)])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])])


What would be the maximal nesting depth a generator can always expect to be compiled successfully on Python 2.7 and 3.5 on? Are there any other similar restrictions that need to be considered when writing a code generator? Or is generating code that way not the preferred solution anyway - the code generator should generate e.g. compiled binary Python code immediately?

Note: in the end the exact same logic code will run as Python process, it is only about how it is loaded into the Python interpreter. Different from the code example in the bug create message, code with similar properties to the one from this example is generated to evaluate a mathematical model, thus not that random and meaningless compared to the putative fuzzer output from the first note.

----------
nosy: +ait

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


More information about the Python-bugs-list mailing list