]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix type hint for with_for_update() to support tuples of table classes
authorShamil <ashm.tech@proton.me>
Tue, 18 Nov 2025 19:22:26 +0000 (22:22 +0300)
committerShamil <ashm.tech@proton.me>
Tue, 18 Nov 2025 19:22:26 +0000 (22:22 +0300)
Fixes #12730

Updated _ForUpdateOfArgument type alias to accept sequences of both
column expressions and FROM clause arguments (tables, ORM entities).
Previously only sequences of column expressions were supported,
causing type checker errors when passing tuples of DeclarativeBase
classes to with_for_update(of=...).

lib/sqlalchemy/sql/selectable.py

index bf60995245599fd70286fa12986c40e79334d449..c212d161514941fb87ea815234c7e9495e07afe8 100644 (file)
@@ -179,8 +179,13 @@ _ForUpdateOfArgument = Union[
         "_ColumnExpressionArgument[Any]",
         "_FromClauseArgument",
     ],
-    # or sequence of single column elements
-    Sequence["_ColumnExpressionArgument[Any]"],
+    # or sequence of column elements or from clauses
+    Sequence[
+        Union[
+            "_ColumnExpressionArgument[Any]",
+            "_FromClauseArgument",
+        ]
+    ],
 ]