Skip to content

Commit a330365

Browse files
author
Erlend Egeberg Aasland
authored
bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)
1 parent 61d8c54 commit a330365

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Modules/_sqlite/clinic/cursor.c.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,13 @@ pysqlite_cursor_fetchone(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
138138
}
139139

140140
PyDoc_STRVAR(pysqlite_cursor_fetchmany__doc__,
141-
"fetchmany($self, /, size=cursor.arraysize)\n"
141+
"fetchmany($self, /, size=1)\n"
142142
"--\n"
143143
"\n"
144-
"Fetches several rows from the resultset.");
144+
"Fetches several rows from the resultset.\n"
145+
"\n"
146+
" size\n"
147+
" The default value is set by the Cursor.arraysize attribute.");
145148

146149
#define PYSQLITE_CURSOR_FETCHMANY_METHODDEF \
147150
{"fetchmany", (PyCFunction)(void(*)(void))pysqlite_cursor_fetchmany, METH_FASTCALL|METH_KEYWORDS, pysqlite_cursor_fetchmany__doc__},
@@ -256,4 +259,4 @@ pysqlite_cursor_close(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
256259
{
257260
return pysqlite_cursor_close_impl(self);
258261
}
259-
/*[clinic end generated code: output=11db0de4fb1951a9 input=a9049054013a1b77]*/
262+
/*[clinic end generated code: output=6a2d4d49784aa686 input=a9049054013a1b77]*/

Modules/_sqlite/cursor.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,15 @@ pysqlite_cursor_fetchone_impl(pysqlite_Cursor *self)
822822
/*[clinic input]
823823
_sqlite3.Cursor.fetchmany as pysqlite_cursor_fetchmany
824824
825-
size as maxrows: int(c_default='self->arraysize') = cursor.arraysize
825+
size as maxrows: int(c_default='self->arraysize') = 1
826+
The default value is set by the Cursor.arraysize attribute.
826827
827828
Fetches several rows from the resultset.
828829
[clinic start generated code]*/
829830

830831
static PyObject *
831832
pysqlite_cursor_fetchmany_impl(pysqlite_Cursor *self, int maxrows)
832-
/*[clinic end generated code: output=a8ef31fea64d0906 input=d80ff999a7701ffb]*/
833+
/*[clinic end generated code: output=a8ef31fea64d0906 input=c26e6ca3f34debd0]*/
833834
{
834835
PyObject* row;
835836
PyObject* list;

0 commit comments

Comments
 (0)