]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix is_pep695 misidentifying Annotated[TypeAliasType] as PEP 695
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Jun 2026 22:06:56 +0000 (18:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Jun 2026 02:09:50 +0000 (22:09 -0400)
commit61e74ff61dae24e4c4eec528e36a71c10bf15294
treed2626c8411c410851651227caa867083457e5491
parentb9f9e48da5b65672a9f755e6f6502f5c5112f506
Fix is_pep695 misidentifying Annotated[TypeAliasType] as PEP 695

The is_pep695() function incorrectly identified
Annotated[TypeAliasType, ...] as a PEP 695 type alias because
Annotated's __origin__ attribute returns the first type argument
(the TypeAliasType) rather than Annotated itself.  This caused
_init_column_for_annotation to crash with AttributeError when
attempting to access __value__ on the Annotated wrapper.

Added a check for is_pep593() before recursing through __origin__
in is_pep695(), so Annotated types are correctly excluded.

Fixes: #13386
Change-Id: I36ef83ebbab5abc08bed0131efb552c3fc001911
doc/build/changelog/unreleased_20/13386.rst [new file with mode: 0644]
lib/sqlalchemy/util/typing.py
test/base/test_typing_utils.py
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py