]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
behave more like dataclasses when creating them
authorFederico Caselli <cfederico87@gmail.com>
Thu, 4 Dec 2025 21:00:32 +0000 (22:00 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Dec 2025 19:13:09 +0000 (14:13 -0500)
commitbe4e3e675e7f69a2e728af2aa814524173d7a66c
tree16c0beaea8593215f443621f04f021ef1abffdc0
parent521fd85a3fdb9249136c5510ecad54f213ca2065
behave more like dataclasses when creating them

A change in the mechanics of how Python dataclasses are applied to classes
that use :class:`.MappedAsDataclass` or
:meth:`.registry.mapped_as_dataclass`, to no longer modify the
`__annotations__` collection that's on the class, instead manipulating
regular class-bound attributes in order to satisfy the class requirements
for the dataclass creation function.  This works around an issue that has
appeared in Python 3.14.1, provides for a much simpler implementation, and
also maintains accurate typing information about the attributes as the
dataclass is built.

Fixes: #13021
Change-Id: I6ae13db7f647ad04e202667d69f2b1bb385c032d
doc/build/changelog/unreleased_21/13021.rst [new file with mode: 0644]
lib/sqlalchemy/orm/decl_base.py
test/orm/declarative/test_dc_transforms.py
test/orm/declarative/test_dc_transforms_future_anno_sync.py