-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed as not planned
Closed as not planned
Copy link
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-dataclassestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The following code crashes on 3.14.0a4 but runs without error on 3.13:
import dataclasses
def my_dataclass(cls):
try:
annotations = cls.__dict__["__annotations__"]
except KeyError:
cls = dataclasses.dataclass()(cls)
else:
new_annotations = dict(annotations)
for name in annotations.keys():
if name == "ignore_this_annotation":
new_annotations.pop(name)
cls.__annotations__ = new_annotations
cls = dataclasses.dataclass()(cls)
cls.__annotations__ = annotations
return cls
@my_dataclass
class X:
x: int = 3
ignore_this_annotation: int
with:
TypeError: non-default argument 'ignore_this_annotation' follows default argument 'x'
Python installed via uv venv --python=3.14
.
x-ref patrick-kidger/optimistix#168 patrick-kidger/equinox#1096)
CPython versions tested on:
3.14
Operating systems tested on:
macOS
johannahaffner
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-dataclassestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error