From d98aab567fb0c2f7b7712cb41952e846c4470650 Mon Sep 17 00:00:00 2001 From: Til Boerner Date: Fri, 23 Jan 2026 14:09:29 +0100 Subject: [PATCH 1/2] [sqlite3] Fix type of row_factory for Connection and Cursor `row_factory`, if not `None`, is a callable that receives a Cursor instance and a tuple of row values. `sqlite3.Row` itself is such a callable, but claiming that it will be passed as an argument to the row_factory function is wrong, as it does not match documented and actual behavior. Although not necessary (since it's covered by the `Callable[...]`), the corrected type hint leaves `type[Row]` in place as an explicit option to make this connection immediately obvious. See https://docs.python.org/3.14/library/sqlite3.html#sqlite3.Cursor.row_factory --- stdlib/sqlite3/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/sqlite3/__init__.pyi b/stdlib/sqlite3/__init__.pyi index de5309235957..5a7fdaec57f2 100644 --- a/stdlib/sqlite3/__init__.pyi +++ b/stdlib/sqlite3/__init__.pyi @@ -222,7 +222,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any _Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData] # Controls the legacy transaction handling mode of sqlite3. _IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None -_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, Row], object] | None +_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, tuple[Any, ...], object] | None @type_check_only class _AnyParamWindowAggregateClass(Protocol): From a2cb033b069f41c659ddf711e7f2da6ed600d920 Mon Sep 17 00:00:00 2001 From: Til Boerner Date: Fri, 23 Jan 2026 14:26:47 +0100 Subject: [PATCH 2/2] Fix syntax error --- stdlib/sqlite3/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/sqlite3/__init__.pyi b/stdlib/sqlite3/__init__.pyi index 5a7fdaec57f2..56bccb56d63a 100644 --- a/stdlib/sqlite3/__init__.pyi +++ b/stdlib/sqlite3/__init__.pyi @@ -222,7 +222,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any _Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData] # Controls the legacy transaction handling mode of sqlite3. _IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None -_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, tuple[Any, ...], object] | None +_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, tuple[Any, ...]], object] | None @type_check_only class _AnyParamWindowAggregateClass(Protocol):