diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-07-13 21:57:48 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-07-13 21:57:48 (GMT) |
commit | 1839bac7965814fc1cfa4e83790ee4f3c213a890 (patch) | |
tree | 09086203c92a619490a1e5a3abf0156659b17010 /Modules/_sqlite/cursor.c | |
parent | dff1834f4540ac3c821e474de3a15293cfc728a9 (diff) | |
download | cpython-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/cursor.c')
-rw-r--r-- | Modules/_sqlite/cursor.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 29d3ff4..14dd002 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -1,6 +1,6 @@ /* 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. * @@ -529,7 +529,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* } rc = pysqlite_statement_create(self->statement, self->connection, operation); if (rc != SQLITE_OK) { - self->statement = 0; + Py_CLEAR(self->statement); goto error; } } @@ -602,7 +602,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* } rc = pysqlite_statement_create(self->statement, self->connection, operation); if (rc != SQLITE_OK) { - self->statement = 0; + Py_CLEAR(self->statement); goto error; } } @@ -711,8 +711,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* 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) { @@ -1013,8 +1012,7 @@ PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args) if (self->statement) { (void)pysqlite_statement_reset(self->statement); - Py_DECREF(self->statement); - self->statement = 0; + Py_CLEAR(self->statement); } Py_INCREF(Py_None); |