]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
liberalize pep695 matching
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Sep 2025 01:44:33 +0000 (21:44 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 6 Sep 2025 16:13:33 +0000 (12:13 -0400)
commita737e965c7edbda1cd89bd6d4a41ebcd157e9441
tree379261e52d2b7b25f8dd4b6a32079752f4ace376
parente263825e3c5060bf4f47eed0e833c6660a31658e
liberalize pep695 matching

after many days of discussion we are moving to liberalize the
matching rules used for pep695 to the simple rule that we will resolve
a pep695 type to its immediate ``__value__`` without requiring that
it be present in the type map, however without any further recursive
checks (that is, we will not resolve ``__value__`` of ``__value__``).
This allows the vast majority of simple uses of pep695 types to not
require entries in the type map, including when the type points
to a simple Python type or any type that is present in the type_map.
Also supported is resolution of generic pep695 types against the
right side, including for Annotated types.

The change here in 2.1 will form the base for a revised approach
to the RegistryEvents patch for #9832, which will still provide
the RegistryEvents.resolve_type_annotation hook.   In 2.0, we need
to scale back the warnings that are emitted so portions of this patch
will also be backported including similar changes to the test suite.

Fixes: #12829
Change-Id: Ib6e379793335da3f33f6ca2cd6874a6eaf1e36f4
doc/build/changelog/changelog_20.rst
doc/build/changelog/unreleased_20/12829.rst [new file with mode: 0644]
doc/build/orm/declarative_tables.rst
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/util/typing.py
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py