From 962f75b225960a6bbb1b9a9244c654c1611c305f Mon Sep 17 00:00:00 2001 From: Jia Junjie <62194633+jiajunjie@users.noreply.github.com> Date: Fri, 30 Sep 2022 09:56:01 +0800 Subject: [PATCH 1/2] Add a return value in sqlite3.Cursor.fetchone document --- Doc/library/sqlite3.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index e2774a502403e7..b18808c969557b 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1425,7 +1425,8 @@ Cursor objects .. method:: fetchone() - Return the next row of a query result set as a :class:`tuple`. + Return the next row of a query result set as a :class:`tuple` or an object + returned by :attr:`~Connection.row_factory`. Return ``None`` if no more data is available. From 9d228e754f54e8ff9a0760362f231dc66f6c7e78 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 5 Oct 2022 10:38:02 +0200 Subject: [PATCH 2/2] Apply CAM's suggestion Co-authored-by: C.A.M. Gerlach --- Doc/library/sqlite3.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index b18808c969557b..26a085877ec112 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1425,8 +1425,9 @@ Cursor objects .. method:: fetchone() - Return the next row of a query result set as a :class:`tuple` or an object - returned by :attr:`~Connection.row_factory`. + If :attr:`~Connection.row_factory` is ``None``, + return the next row query result set as a :class:`tuple`. + Else, pass it to the row factory and return its result. Return ``None`` if no more data is available.