mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-13 20:27:35 -04:00
8a45f13ef6
Fixed issue regarding ``Union`` types that would be present in the :paramref:`_orm.registry.type_annotation_map` of a :class:`_orm.registry` or declarative base class, where a ``Mapped[]`` element that included one of the subtypes present in that ``Union`` would be matched to that entry, potentially ignoring other entries that matched exactly. The correct behavior now takes place such that an entry should only match in ``type_annotation_map`` exactly, as a ``Union`` type is a self-contained type. For example, an attribute with ``Mapped[float]`` would previously match to a ``type_annotation_map`` entry ``Union[float, Decimal]``; this will no longer match and will now only match to an entry that states ``float``. Pull request courtesy Frazer McLean. Fixes #11370 Closes: #11942 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11942 Pull-request-sha:21a3d1971aChange-Id: I3467be00f8fa8bd011dd4805a77a3b80ff74a215 (cherry picked from commit40c30ec446)