summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-07-13 21:57:48 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-07-13 21:57:48 (GMT)
commit1839bac7965814fc1cfa4e83790ee4f3c213a890 (patch)
tree09086203c92a619490a1e5a3abf0156659b17010 /Modules/_sqlite/connection.c
parentdff1834f4540ac3c821e474de3a15293cfc728a9 (diff)
downloadcpython-1839bac7965814fc1cfa4e83790ee4f3c213a890.zip
cpython-1839bac7965814fc1cfa4e83790ee4f3c213a890.tar.gz
cpython-1839bac7965814fc1cfa4e83790ee4f3c213a890.tar.bz2
Forward port r64930.
Fix one more case in cursor.c.
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 2d1b822..b2cca80 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -944,19 +944,16 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
_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;
}
@@ -980,15 +977,13 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args,
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:
@@ -1011,15 +1006,13 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
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:
@@ -1042,15 +1035,13 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
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: