diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-24 08:39:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-24 08:39:57 (GMT) |
commit | f0069403518243e37da0aaaa1148d9dfee1adebd (patch) | |
tree | c6fc0eb9f3dc2b917e2f998cb25e59248453d49d /Modules/_sqlite/cursor.c | |
parent | 2bd58e39918d83c639366c69a4da247238f8183f (diff) | |
parent | 5a57ade58ec5bee85db41b8ce1340ff077781b65 (diff) | |
download | cpython-f0069403518243e37da0aaaa1148d9dfee1adebd.zip cpython-f0069403518243e37da0aaaa1148d9dfee1adebd.tar.gz cpython-f0069403518243e37da0aaaa1148d9dfee1adebd.tar.bz2 |
Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r-- | Modules/_sqlite/cursor.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index c1599c0..d909738 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -170,8 +170,7 @@ int pysqlite_build_row_cast_map(pysqlite_Cursor* self) return 0; } - Py_XDECREF(self->row_cast_map); - self->row_cast_map = PyList_New(0); + Py_SETREF(self->row_cast_map, PyList_New(0)); for (i = 0; i < sqlite3_column_count(self->statement->st); i++) { converter = NULL; @@ -510,9 +509,8 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* goto error; /* reset description and rowcount */ - Py_DECREF(self->description); Py_INCREF(Py_None); - self->description = Py_None; + Py_SETREF(self->description, Py_None); self->rowcount = -1L; func_args = PyTuple_New(1); @@ -537,8 +535,8 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* } if (self->statement->in_use) { - Py_DECREF(self->statement); - self->statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType); + Py_SETREF(self->statement, + PyObject_New(pysqlite_Statement, &pysqlite_StatementType)); if (!self->statement) { goto error; } @@ -654,8 +652,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* numcols = sqlite3_column_count(self->statement->st); Py_END_ALLOW_THREADS - Py_DECREF(self->description); - self->description = PyTuple_New(numcols); + Py_SETREF(self->description, PyTuple_New(numcols)); if (!self->description) { goto error; } |