(callable != Py_None) ? callable : NULL,
(callable != Py_None) ? pysqlite_collation_callback : NULL);
if (rc != SQLITE_OK) {
- PyDict_DelItem(self->collations, uppercase_name);
+ if (callable != Py_None) {
+ if (PyDict_DelItem(self->collations, uppercase_name) < 0) {
+ PyErr_Clear();
+ }
+ }
_pysqlite_seterror(self->db, NULL);
goto finally;
}
}
if (!multiple) {
- Py_DECREF(self->lastrowid);
Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db);
Py_END_ALLOW_THREADS
- self->lastrowid = PyLong_FromLongLong(lastrowid);
+ Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
+ if (self->lastrowid == NULL) {
+ goto error;
+ }
}
if (rc == SQLITE_ROW) {
}
while ((row = pysqlite_cursor_iternext(self))) {
- PyList_Append(list, row);
- Py_XDECREF(row);
+ if (PyList_Append(list, row) < 0) {
+ Py_DECREF(row);
+ break;
+ }
+ Py_DECREF(row);
if (++counter == maxrows) {
break;
}
while ((row = pysqlite_cursor_iternext(self))) {
- PyList_Append(list, row);
- Py_XDECREF(row);
+ if (PyList_Append(list, row) < 0) {
+ Py_DECREF(row);
+ break;
+ }
+ Py_DECREF(row);
}
if (PyErr_Occurred()) {