]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Make __class_getitem__ a function 7470/head
authorKai Mueller <15907922+kasium@users.noreply.github.com>
Tue, 21 Dec 2021 11:12:30 +0000 (11:12 +0000)
committerKai Mueller <15907922+kasium@users.noreply.github.com>
Tue, 21 Dec 2021 11:12:30 +0000 (11:12 +0000)
lib/sqlalchemy/orm/decl_api.py

index e44ca111a79499d880755f6a6bc716b2fe218baa..17cc7bb120a450d0354f6b06918ecbfd169af5a3 100644 (file)
@@ -788,7 +788,11 @@ class registry:
         if mapper:
             class_dict["__mapper_cls__"] = mapper
         if hasattr(cls, "__class_getitem__"):
-            class_dict["__class_getitem__"] = lambda cls, _: cls
+
+            def __class_getitem__(cls, key):
+                return cls
+
+            class_dict["__class_getitem__"] = __class_getitem__
 
         return metaclass(name, bases, class_dict)