Eric V. Smith <[email protected]> added the comment:
A simpler reproducer is:
codeop.compile_command('[' * 100)
Verified I get MemoryError on cygwin PYthon 3.8.12. A length of 99 does not
show a problem.
On Windows 3.11.0a5+, I get:
>>> codeop.compile_command('[' * 201)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 107, in
compile_command
return _maybe_compile(_compile, source, filename, symbol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 70, in
_maybe_compile
compiler(source + "\n", filename, symbol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\home\eric\local\python\cpython\Lib\codeop.py", line 86, in _compile
return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT |
PyCF_ALLOW_INCOMPLETE_INPUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<input>", line 1
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
^
SyntaxError: too many nested parentheses
A length of 200 seems to work correctly.
So it looks like this was fixed somewhere along the line, I'm guessing with the
PEG parser. I suspect backporting the fix to older versions won't be possible.
----------
nosy: +eric.smith
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue47137>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com