You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dataclasses without __init__ no longer work in 3.14.1 due to #137711 #142214
The resolution for #137530, #137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without __init__.
Although a dataclass without __init__ doesn't seem that helpful, it doesn't seem to be explicitly forbidden and shouldn't break in a point release.
changed the title [-]Dataclasses without __init__ no longer work due to #137711[/-][+]Dataclasses without __init__ no longer work in 3.14.1 due to #137711[/+]on Dec 3, 2025
Looks like we're seeing two different side effects from the recent annotation updates.
1 The NetworkX crash: It seems init=False exposes object.init (a wrapper descriptor), which naturally lacks annotate.
2 The SQLAlchemy KeyError: It looks like the code assumes every field must exist in cls_annotations. That assumption might be too strict for dynamic classes where attributes are injected.
I suspect adding guards in both spots to handle missing attributes/keys would fix this?
The fact that they had to rush that merge to unblock CI—even skipping the documentation steps you suggested—really confirms how severe the instability is for downstream users.
changed the title [-]Dataclasses without __init__ no longer work in 3.14.1 due to #137711[/-][+]Dataclasses without `__init__` no longer work in 3.14.1 due to #137711[/+]on Dec 3, 2025
I was thinking, could there be something in the CPython release process for maintenance releases which sanity checks that an assortment of heavily used libraries such as networkx and sqlalchemy can successfully import?
That sounds like some low hanging fruit, and something easy to automate for catching potentially disruptive issues before the release is published and gets picked up by various GitHub actions. I had some uv python install 3.14 in .github/workflows which automatically picked up the micro bump on Dec 2 and CIs got trashed (fortunately the fix was trivial just pinning it to 3.14.0 in the workflow yaml).
a coordinated release seems a little heavy handed, but there's no reason people (anyone, python devs, OSS authors, interested parties) can't run CIs (like a series of github actions somehwere) that test the Python main branch against some series of OSS libraries, and just report github issues for failures that are observed.
CIs like these can be burdensome as when you are tracking the "main" of another project, there's often unrelated problems that get checked into main. plus you have to stay on top of deployment / test runner changes in the project (though cPython is extremely good at staying exactly the same in my experience).
Activity
[-]Dataclasses without __init__ no longer work due to #137711[/-][+]Dataclasses without __init__ no longer work in 3.14.1 due to #137711[/+]dpinol commentedon Dec 3, 2025
as an example, it breaks networkx 3.6
Giuzzilla commentedon Dec 3, 2025
Python 3.14.1 is breaking my sqlalchemy-based project as well, seems related to the issue/dataclasses, stacktrace:
mypackage/mymodel.py:109: in <module> class MyModel(Base, kw_only=True): .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_api.py:626: in __init_subclass__ super().__init_subclass__(**kw) .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_api.py:846: in __init_subclass__ _as_declarative(cls._sa_registry, cls, cls.__dict__) .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_base.py:245: in _as_declarative return _MapperConfig.setup_mapping(registry, cls, dict_, None, {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_base.py:326: in setup_mapping return _ClassScanMapperConfig( .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_base.py:564: in __init__ self._setup_dataclasses_transforms() .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_base.py:1171: in _setup_dataclasses_transforms self._apply_dataclasses_to_any_class( .venv/lib/python3.14/site-packages/sqlalchemy/orm/decl_base.py:1227: in _apply_dataclasses_to_any_class dataclass_callable( # type: ignore[call-overload] /usr/local/lib/python3.14/dataclasses.py:1436: in dataclass return wrap(cls) ^^^^^^^^^ /usr/local/lib/python3.14/dataclasses.py:1426: in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, /usr/local/lib/python3.14/dataclasses.py:1217: in _process_class text_sig = str(inspect.signature( /usr/local/lib/python3.14/inspect.py:3321: in signature return Signature.from_callable(obj, follow_wrapped=follow_wrapped, /usr/local/lib/python3.14/inspect.py:3036: in from_callable return _signature_from_callable(obj, sigcls=cls, /usr/local/lib/python3.14/inspect.py:2557: in _signature_from_callable return _get_signature_of(init) ^^^^^^^^^^^^^^^^^^^^^^^ /usr/local/lib/python3.14/inspect.py:2440: in _signature_from_callable sig = _get_signature_of(obj.__func__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /usr/local/lib/python3.14/inspect.py:2511: in _signature_from_callable return _signature_from_function(sigcls, obj, /usr/local/lib/python3.14/inspect.py:2334: in _signature_from_function annotations = get_annotations(func, globals=globals, locals=locals, eval_str=eval_str, /usr/local/lib/python3.14/annotationlib.py:973: in get_annotations ann = _get_and_call_annotate(obj, format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /usr/local/lib/python3.14/annotationlib.py:1112: in _get_and_call_annotate ann = call_annotate_function(annotate, format, owner=obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /usr/local/lib/python3.14/annotationlib.py:711: in call_annotate_function return annotate(format) ^^^^^^^^^^^^^^^^ /usr/local/lib/python3.14/dataclasses.py:553: in __annotate__ new_annotations[k] = cls_annotations[k] ^^^^^^^^^^^^^^^^^^ E KeyError: 'my_field'pareshjoshij commentedon Dec 3, 2025
Looks like we're seeing two different side effects from the recent annotation updates.
1 The NetworkX crash: It seems init=False exposes object.init (a wrapper descriptor), which naturally lacks annotate.
2 The SQLAlchemy KeyError: It looks like the code assumes every field must exist in cls_annotations. That assumption might be too strict for dynamic classes where attributes are injected.
I suspect adding guards in both spots to handle missing attributes/keys would fix this?
sobolevn commentedon Dec 3, 2025
Also got this error today: https://github.com/wemake-services/django-modern-rest/actions/runs/19889091191/job/57003155723
pareshjoshij commentedon Dec 3, 2025
@epenet that link speaks volumes.
The fact that they had to rush that merge to unblock CI—even skipping the documentation steps you suggested—really confirms how severe the instability is for downstream users.
[-]Dataclasses without __init__ no longer work in 3.14.1 due to #137711[/-][+]Dataclasses without `__init__` no longer work in 3.14.1 due to #137711[/+]20 remaining items
Avoid Python 3.14.1
hugovk commentedon Dec 5, 2025
Thanks all, merged and backported, will hopefully be released in 3.14.2 today.
DEP: blocklist 3.14.1
pythongh-142214: Fix two regressions in dataclasses (python#142223)
Blocklist Python 3.14.1 (#8372)
Add Python 3.14 back to CI matrix
wimglenn commentedon Dec 10, 2025
I was thinking, could there be something in the CPython release process for maintenance releases which sanity checks that an assortment of heavily used libraries such as networkx and sqlalchemy can successfully import?
That sounds like some low hanging fruit, and something easy to automate for catching potentially disruptive issues before the release is published and gets picked up by various GitHub actions. I had some
uv python install 3.14in .github/workflows which automatically picked up the micro bump on Dec 2 and CIs got trashed (fortunately the fix was trivial just pinning it to3.14.0in the workflow yaml).hugovk commentedon Dec 10, 2025
It's been considered in the past (for example, PEP 608 / https://discuss.python.org/t/rejected-rfc-pep-608-coordinated-python-release/2539 six years ago) but iirc rejected due to the amount of work and diversity of test setups.
I suggest opening a new discussion, though, if you think things are better now to retry it.
zzzeek commentedon Dec 10, 2025
a coordinated release seems a little heavy handed, but there's no reason people (anyone, python devs, OSS authors, interested parties) can't run CIs (like a series of github actions somehwere) that test the Python main branch against some series of OSS libraries, and just report github issues for failures that are observed.
CIs like these can be burdensome as when you are tracking the "main" of another project, there's often unrelated problems that get checked into main. plus you have to stay on top of deployment / test runner changes in the project (though cPython is extremely good at staying exactly the same in my experience).
encukou commentedon Dec 10, 2025
I've been thinking whether the 3.x.1 release needs a RC period, given that all fixes from the long 3.x.0 RC period land there.
conditionally pin macos builds to 3.14.0
Temporary pin of Python 3.14.0 to work around upstream bug (#113)
hugovk commentedon Feb 2, 2026
Reported @stomde to GitHub.