]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix: compatibility with typing_extensions 4.13 and type statement
authorDaraan <github.blurry@9ox.net>
Wed, 26 Mar 2025 17:45:56 +0000 (18:45 +0100)
committerDaraan <github.blurry@9ox.net>
Wed, 26 Mar 2025 17:45:56 +0000 (18:45 +0100)
lib/sqlalchemy/util/typing.py

index a1fb5920b9533196ddf99fe980d514175184128c..fa0332ed53bb878fefd201dcaf789b0ee49a9a0b 100644 (file)
@@ -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)