Skip to content

Possible MemoryError regression in Python 3.14 since alpha 6 #135028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
frenzymadness opened this issue Jun 2, 2025 · 2 comments
Closed

Possible MemoryError regression in Python 3.14 since alpha 6 #135028

frenzymadness opened this issue Jun 2, 2025 · 2 comments
Labels
3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-parser type-bug An unexpected behavior, bug, or error

Comments

@frenzymadness
Copy link
Contributor

frenzymadness commented Jun 2, 2025

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

@frenzymadness frenzymadness added the type-bug An unexpected behavior, bug, or error label Jun 2, 2025
@JelleZijlstra JelleZijlstra added topic-parser 3.14 bugs and security fixes labels Jun 2, 2025
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jun 2, 2025
vstinner added a commit to vstinner/cpython that referenced this issue Jun 2, 2025
@vstinner
Copy link
Member

vstinner commented Jun 2, 2025

I propose #135031 to fix this issue.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 3, 2025
…honGH-135031)

(cherry picked from commit 6e80f11)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this issue Jun 3, 2025
…-135031) (#135059)

gh-135028: Increase parser MAXSTACK for nested parenthesis (GH-135031)
(cherry picked from commit 6e80f11)

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner vstinner closed this as completed Jun 5, 2025
@vstinner
Copy link
Member

vstinner commented Jun 5, 2025

Fixed, thanks for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-parser type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants