_pysqlite_seterror(self->db, NULL);
}
- Py_DECREF(statement);
- statement = 0;
+ Py_CLEAR(statement);
} else {
weakref = PyWeakref_NewRef((PyObject*)statement, NULL);
if (!weakref) {
- Py_DECREF(statement);
- statement = 0;
+ Py_CLEAR(statement);
goto error;
}
if (PyList_Append(self->statements, weakref) != 0) {
- Py_DECREF(weakref);
- statement = 0;
+ Py_CLEAR(weakref);
goto error;
}
method = PyObject_GetAttrString(cursor, "execute");
if (!method) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
goto error;
}
result = PyObject_CallObject(method, args);
if (!result) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
}
error:
method = PyObject_GetAttrString(cursor, "executemany");
if (!method) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
goto error;
}
result = PyObject_CallObject(method, args);
if (!result) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
}
error:
method = PyObject_GetAttrString(cursor, "executescript");
if (!method) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
goto error;
}
result = PyObject_CallObject(method, args);
if (!result) {
- Py_DECREF(cursor);
- cursor = 0;
+ Py_CLEAR(cursor);
}
error:
/* cursor.c - the cursor type
*
- * Copyright (C) 2004-2007 Gerhard Häring <gh@ghaering.de>
+ * Copyright (C) 2004-2007 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
}
rc = pysqlite_statement_create(self->statement, self->connection, operation);
if (rc != SQLITE_OK) {
- self->statement = 0;
+ Py_CLEAR(self->statement);
goto error;
}
}
}
rc = pysqlite_statement_create(self->statement, self->connection, operation);
if (rc != SQLITE_OK) {
- self->statement = 0;
+ Py_CLEAR(self->statement);
goto error;
}
}
self->next_row = _pysqlite_fetch_one_row(self);
} else if (rc == SQLITE_DONE && !multiple) {
pysqlite_statement_reset(self->statement);
- Py_DECREF(self->statement);
- self->statement = 0;
+ Py_CLEAR(self->statement);
}
switch (statement_type) {
if (self->statement) {
(void)pysqlite_statement_reset(self->statement);
- Py_DECREF(self->statement);
- self->statement = 0;
+ Py_CLEAR(self->statement);
}
Py_INCREF(Py_None);