Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a segmentation fault in :mod:`sqlite3` when ``row_factory`` is deleted
and a query is executed afterward.
Comment thread
sepehr-rs marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
return NULL;
}

if (cursor && self->row_factory != Py_None) {
if (cursor && self->row_factory && self->row_factory != Py_None) {
Comment thread
sepehr-rs marked this conversation as resolved.
Outdated
Py_INCREF(self->row_factory);
Py_XSETREF(((pysqlite_Cursor *)cursor)->row_factory, self->row_factory);
}
Expand Down
Loading