🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-93829: In sqlite3, replace Py_BuildValue with faster APIs
  • Loading branch information
erlend-aasland committed Jun 15, 2022
commit bf38cec54fff945b8420491b14dccc88cb0f6901
3 changes: 1 addition & 2 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,9 +1582,8 @@ static PyObject* pysqlite_connection_get_total_changes(pysqlite_Connection* self
{
if (!pysqlite_check_connection(self)) {
return NULL;
} else {
return Py_BuildValue("i", sqlite3_total_changes(self->db));
}
return PyLong_FromLong(sqlite3_total_changes(self->db));
}

static PyObject* pysqlite_connection_get_in_transaction(pysqlite_Connection* self, void* unused)
Expand Down
4 changes: 2 additions & 2 deletions Modules/_sqlite/microprotocols.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pysqlite_microprotocols_add(pysqlite_state *state, PyTypeObject *type,

assert(type != NULL);
assert(proto != NULL);
key = Py_BuildValue("(OO)", (PyObject*)type, proto);
key = PyTuple_Pack(2, (PyObject *)type, proto);
if (!key) {
return -1;
}
Expand All @@ -81,7 +81,7 @@ pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
way to get a quotable object to be its instance */

/* look for an adapter in the registry */
key = Py_BuildValue("(OO)", (PyObject*)Py_TYPE(obj), proto);
key = PyTuple_Pack(2, (PyObject *)Py_TYPE(obj), proto);
if (!key) {
return NULL;
}
Expand Down