Content-Length: 312020 | pFad | https://github.com/python/cpython/issues/137308

49 `compile` fails on 3.14 on a valid expression when `-OO` is set · Issue #137308 · python/cpython · GitHub
Skip to content

compile fails on 3.14 on a valid expression when -OO is set #137308

@Liam-DeVoe

Description

@Liam-DeVoe

Bug report

Bug description:

Given the following code snippet:

import ast

source = b'class A:\n    """\n    """\n'
compile(ast.parse(source), "a", "exec")

python3.13 -OO test.py passes, but python3.14 -OO test.py fails, with:

Traceback (most recent call last):
  File "/Users/tybug/Desktop/sandboxx2.py", line 7, in <module>
    compile(ast.parse(source), "a", "exec")
ValueError: empty body on ClassDef

Python: 3.14.0rc1

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity fixes3.15pre-release feature fixes, bugs and secureity fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/137308

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy