Skip to content

Commit 88d3efe

Browse files
committed
gh-155781: Hold strong references to sqlite3 converters
Signed-off-by: cuishuang <imcusg@gmail.com>
1 parent 0df980d commit 88d3efe

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Modules/_sqlite/cursor.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,9 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
299299
}
300300
}
301301

302-
if (!converter) {
303-
converter = Py_NewRef(Py_None);
304-
}
305-
306-
int rc = PyList_Append(self->row_cast_map, converter);
307-
Py_DECREF(converter);
302+
int rc = PyList_Append(self->row_cast_map,
303+
converter ? converter : Py_None);
304+
Py_XDECREF(converter);
308305
if (rc != 0) {
309306
Py_CLEAR(self->row_cast_map);
310307
return -1;

0 commit comments

Comments
 (0)