summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2018-07-30 21:11:50 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-07-30 21:11:50 (GMT)
commitb229b072a9e972905883da5e9eed1f22ab81c7b7 (patch)
tree66456488e4bea2a077ec33587d3fa39e4ae6bc88 /Modules/_sqlite/cursor.c
parent9045199c5aaeac9b52537581be127d999b5944ee (diff)
downloadcpython-b229b072a9e972905883da5e9eed1f22ab81c7b7.zip
cpython-b229b072a9e972905883da5e9eed1f22ab81c7b7.tar.gz
cpython-b229b072a9e972905883da5e9eed1f22ab81c7b7.tar.bz2
Remove creation of a list for row_cast_map in pysqlite_cursor_init() (GH-8494)
This list is never used: if detect_types is on, this list will be replaced with another one before row_cast_map is used, if detect_types is off, row_cast_map is not used at all.
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 70b304f..c62ad5d 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -42,11 +42,7 @@ static int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject*
Py_XSETREF(self->connection, connection);
Py_CLEAR(self->statement);
Py_CLEAR(self->next_row);
-
- Py_XSETREF(self->row_cast_map, PyList_New(0));
- if (!self->row_cast_map) {
- return -1;
- }
+ Py_CLEAR(self->row_cast_map);
Py_INCREF(Py_None);
Py_XSETREF(self->description, Py_None);
@@ -253,6 +249,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
for (i = 0; i < numcols; i++) {
if (self->connection->detect_types) {
+ assert(self->row_cast_map != NULL);
converter = PyList_GetItem(self->row_cast_map, i);
if (!converter) {
converter = Py_None;