Skip to content

Possible MemoryError regression in Python 3.14 since alpha 6 #135028

Closed
@frenzymadness

Description

@frenzymadness

Bug report

Bug description:

Running a simple piece of code:

eval("(" * 200 + ")" * 200)

raised an error like this in Python 3.8:

>>> eval("(" * 200 + ")" * 200)
s_push: parser stack overflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

It was then fixed in Python 3.9 (by the new parser, I guess) and it's now back – since 3.14 alpha 6 the error for the same code is:

>>> eval("(" * 200 + ")" * 200)
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    eval("(" * 200 + ")" * 200)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^
MemoryError: Parser stack overflowed - Python source too complex to parse

I did a bisection and found commit 0142236 by @markshannon, after which we see the same error. as before

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions