From 96a2a0d6fe728d596e4bb3ad6b0f9e1517a04d42 Mon Sep 17 00:00:00 2001 From: Daraan Date: Wed, 26 Mar 2025 18:45:56 +0100 Subject: [PATCH] fix: compatibility with typing_extensions 4.13 and type statement --- lib/sqlalchemy/util/typing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/sqlalchemy/util/typing.py b/lib/sqlalchemy/util/typing.py index a1fb5920b9..fa0332ed53 100644 --- a/lib/sqlalchemy/util/typing.py +++ b/lib/sqlalchemy/util/typing.py @@ -356,6 +356,9 @@ def is_generic(type_: _AnnotationScanType) -> TypeGuard[GenericProtocol[Any]]: def is_pep695(type_: _AnnotationScanType) -> TypeGuard[TypeAliasType]: + if hasattr(typing, "TypeAliasType"): + # Types should be differentiated + return isinstance(type_, (TypeAliasType, typing.TypeAliasType)) # type: ignore[attr-defined] return isinstance(type_, TypeAliasType) -- 2.47.3