From 5a1ca36862e643cf7748501b97c2e1554b9e0fca Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 11 Oct 2021 13:10:55 +0100 Subject: [PATCH 1/2] Mark Cursor.rowcount as an `int` DBAPI2 [specifies](https://www.python.org/dev/peps/pep-0249/#rowcount) that this is a "number" rather than specifically an int. It notes that a future version of the API might use `None` in place of `-1` to signal that there's no rowcount value to report. But that would presumably belong in a DBAPI version 3. --- stdlib/sqlite3/dbapi2.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index abce96305c7b..6762b35490ed 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -167,7 +167,7 @@ class Cursor(Iterator[Any]): description: Any lastrowid: Any row_factory: Any - rowcount: Any + rowcount: int # TODO: Cursor class accepts exactly 1 argument # required type is sqlite3.Connection (which is imported as _Connection) # however, the name of the __init__ variable is unknown From 2650b81d5153c7bffdb6584e1fcd402bc1b82f51 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 11 Oct 2021 13:18:16 +0100 Subject: [PATCH 2/2] Mark rowcount as long in python2, too --- stdlib/@python2/sqlite3/dbapi2.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/@python2/sqlite3/dbapi2.pyi b/stdlib/@python2/sqlite3/dbapi2.pyi index fadfcc8f5884..023a0506f4aa 100644 --- a/stdlib/@python2/sqlite3/dbapi2.pyi +++ b/stdlib/@python2/sqlite3/dbapi2.pyi @@ -135,7 +135,7 @@ class Cursor(Iterator[Any]): description: Any lastrowid: Any row_factory: Any - rowcount: Any + rowcount: int # TODO: Cursor class accepts exactly 1 argument # required type is sqlite3.Connection (which is imported as _Connection) # however, the name of the __init__ variable is unknown