Skip to content

Commit b229b07

Browse files
sir-sigurdberkerpeksag
authored andcommitted
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.
1 parent 9045199 commit b229b07

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Modules/_sqlite/cursor.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ static int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject*
4242
Py_XSETREF(self->connection, connection);
4343
Py_CLEAR(self->statement);
4444
Py_CLEAR(self->next_row);
45-
46-
Py_XSETREF(self->row_cast_map, PyList_New(0));
47-
if (!self->row_cast_map) {
48-
return -1;
49-
}
45+
Py_CLEAR(self->row_cast_map);
5046

5147
Py_INCREF(Py_None);
5248
Py_XSETREF(self->description, Py_None);
@@ -253,6 +249,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
253249

254250
for (i = 0; i < numcols; i++) {
255251
if (self->connection->detect_types) {
252+
assert(self->row_cast_map != NULL);
256253
converter = PyList_GetItem(self->row_cast_map, i);
257254
if (!converter) {
258255
converter = Py_None;

0 commit comments

Comments
 (0)