]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
modernize annotationlib approach
authorMichael Bayer <mike_mp@zzzcomputing.com>
Sat, 6 Dec 2025 15:38:30 +0000 (15:38 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Dec 2025 18:04:51 +0000 (13:04 -0500)
commitceeac6d91ddab3bf7121a1ea4646abadc3b8c98f
treee41ab5a6a47d4c754c68abf5c40beedef0cfb3f7
parent7b558b02e3cf5aafd181266810dcc6b8c4fd0734
modernize annotationlib approach

This reverts commit 4ff1d604f9bec061fb1936b80d3ed09979d930e8 which reverted this change originally,
so it restores the change.

Change continues here where we now use py314's built in
annotationlib for get_annotations; issue [1] was fixed long
ago before 3.14.0 was released.

change for now:

A change in the mechanics of how Python dataclasses are applied to classes
that use :class:`.MappedAsDataclass` or
:meth:`.registry.mapped_as_dataclass` to apply ``__annotations__`` that are
as identical as is possible to the original ``__annotations__`` given,
while also adding attributes that SQLAlchemy considers to be part of
dataclass ``__annotations__``, then restoring the previous annotations in
exactly the same format as they were, using patterns that work with
:pep:`649` as closely as possible.

[1] https://github.com/python/cpython/issues/133684

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