Liam-DeVoe · GitHub

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/sandbox2.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

Read the original on github.com ↗