Skip to content
Merged
Prev Previous commit
Next Next commit
Fixed PyObject_Vectorcall() call and SQL placeholder.
  • Loading branch information
felixxm committed Jan 24, 2024
commit b1ae087a0b757556279c554f5140542700ce38b6
4 changes: 2 additions & 2 deletions Lib/sqlite3/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _iterdump(connection, *, filter=None):

if filter:
# Return database objects which match the filter pattern.
filter_name_clause = 'AND "name" LIKE %s'
filter_name_clause = 'AND "name" LIKE ?'
params = [filter]
else:
filter_name_clause = ""
Expand Down Expand Up @@ -97,7 +97,7 @@ def _iterdump(connection, *, filter=None):
"type" IN ('index', 'trigger', 'view')
{filter_name_clause}
"""
schema_res = cu.execute(q)
schema_res = cu.execute(q, params)
for name, type, sql in schema_res.fetchall():
yield('{0};'.format(sql))

Expand Down
6 changes: 4 additions & 2 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2003,8 +2003,10 @@ pysqlite_connection_iterdump_impl(pysqlite_Connection *self,
}
return NULL;
}
PyObject *args[1] = {(PyObject *)self};
PyObject *retval = PyObject_Vectorcall(iterdump, args, 1, filter);
PyObject *args[2] = {(PyObject *)self, filter};
PyObject *kwnames = PyTuple_New(1);
PyTuple_SET_ITEM(kwnames, 0, PyUnicode_FromString("filter"));
PyObject *retval = PyObject_Vectorcall(iterdump, args, 1, kwnames);
Comment thread
felixxm marked this conversation as resolved.
Outdated
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
Py_DECREF(iterdump);
return retval;
}
Expand Down