This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-04-15.09:23:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618478615.92.0.752682980963.issue43852@roundup.psfhosted.org>
In-reply-to
Content
All but one of the PyTuple_SetItem() calls are executed without checking the return value.

Callers:
$ grep -r PyTuple_SetItem Modules/_sqlite 
Modules/_sqlite/connection.c:        PyTuple_SetItem(args, i, cur_py_value);
Modules/_sqlite/cursor.c:        PyTuple_SetItem(row, i, converted);
Modules/_sqlite/cursor.c:    if (PyTuple_SetItem(func_args, 0, Py_NewRef(operation)) != 0) {
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 0, column_name);
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 1, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 2, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 3, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 4, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 5, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(descriptor, 6, Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:                PyTuple_SetItem(self->description, i, descriptor);


All of these are operating on newly created tuples, so I suggest replacing them with PyTuple_SET_ITEM() instead of adding error handling.


For the users in _pysqlite_query_execute() I also suggest to move the tuple creation closer to the code that fills it, in order to minimise the number of decref's needed in case of error.
History
Date User Action Args
2021-04-15 09:23:35erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-04-15 09:23:35erlendaaslandsetmessageid: <1618478615.92.0.752682980963.issue43852@roundup.psfhosted.org>
2021-04-15 09:23:35erlendaaslandlinkissue43852 messages
2021-04-15 09:23:35erlendaaslandcreate