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) pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
{ {
PyObject* script_obj; PyObject* script_obj;
PyObject* script_str = NULL;
const char* script_cstr; const char* script_cstr;
sqlite3_stmt* statement; sqlite3_stmt* statement;
int rc; int rc;
@ -685,8 +684,6 @@ pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
} }
error: error:
Py_XDECREF(script_str);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
return NULL; return NULL;
} else { } 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) 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* row;
PyObject* list; PyObject* list;
@ -789,17 +786,9 @@ PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObj
return NULL; return NULL;
} }
/* just make sure we enter the loop */ while ((row = pysqlite_cursor_iternext(self))) {
row = Py_None; PyList_Append(list, row);
Py_XDECREF(row);
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
} else {
break;
}
if (++counter == maxrows) { if (++counter == maxrows) {
break; break;
@ -824,15 +813,9 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
return NULL; return NULL;
} }
/* just make sure we enter the loop */ while ((row = pysqlite_cursor_iternext(self))) {
row = (PyObject*)Py_None; PyList_Append(list, row);
Py_XDECREF(row);
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
}
} }
if (PyErr_Occurred()) { if (PyErr_Occurred()) {

View file

@ -105,7 +105,7 @@ RAM instead of on disk.");
static PyObject* module_complete(PyObject* self, PyObject* args, PyObject* static PyObject* module_complete(PyObject* self, PyObject* args, PyObject*
kwargs) kwargs)
{ {
static char *kwlist[] = {"statement", NULL, NULL}; static char *kwlist[] = {"statement", NULL};
char* statement; char* statement;
PyObject* result; PyObject* result;
@ -135,7 +135,7 @@ Checks if a string contains a complete SQL statement. Non-standard.");
static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject* static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject*
kwargs) kwargs)
{ {
static char *kwlist[] = {"do_enable", NULL, NULL}; static char *kwlist[] = {"do_enable", NULL};
int do_enable; int do_enable;
int rc; int rc;