Merge upstream changes.

This commit is contained in:
Charles Leifer 2020-02-04 07:32:59 -06:00
parent 030818f448
commit 925221c9fa
2 changed files with 9 additions and 26 deletions

View file

@ -611,7 +611,6 @@ static PyObject *
pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
{
PyObject* script_obj;
PyObject* script_str = NULL;
const char* script_cstr;
sqlite3_stmt* statement;
int rc;
@ -685,8 +684,6 @@ pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
}
error:
Py_XDECREF(script_str);
if (PyErr_Occurred()) {
return NULL;
} else {
@ -773,7 +770,7 @@ PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args)
PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs)
{
static char *kwlist[] = {"size", NULL, NULL};
static char *kwlist[] = {"size", NULL};
PyObject* row;
PyObject* list;
@ -789,17 +786,9 @@ PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObj
return NULL;
}
/* just make sure we enter the loop */
row = Py_None;
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
} else {
break;
}
while ((row = pysqlite_cursor_iternext(self))) {
PyList_Append(list, row);
Py_XDECREF(row);
if (++counter == maxrows) {
break;
@ -824,15 +813,9 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
return NULL;
}
/* just make sure we enter the loop */
row = (PyObject*)Py_None;
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
}
while ((row = pysqlite_cursor_iternext(self))) {
PyList_Append(list, row);
Py_XDECREF(row);
}
if (PyErr_Occurred()) {