mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-42064: Optimise sqlite3
state access, part 1 (GH-27273)
Prepare for module state: - Add "get state by defining class" and "get state by module def" stubs - Add AC defining class when needed - Add state pointer to connection context - Pass state as argument to utility functions Automerge-Triggered-By: GH:encukou
This commit is contained in:
parent
47fd4726a2
commit
d542742128
13 changed files with 103 additions and 66 deletions
|
@ -71,7 +71,8 @@ pysqlite_microprotocols_add(PyTypeObject *type, PyObject *proto, PyObject *cast)
|
|||
/* pysqlite_microprotocols_adapt - adapt an object to the built-in protocol */
|
||||
|
||||
PyObject *
|
||||
pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
|
||||
pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
|
||||
PyObject *proto, PyObject *alt)
|
||||
{
|
||||
_Py_IDENTIFIER(__adapt__);
|
||||
_Py_IDENTIFIER(__conform__);
|
||||
|
@ -86,7 +87,6 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
|
|||
if (!key) {
|
||||
return NULL;
|
||||
}
|
||||
pysqlite_state *state = pysqlite_get_state(NULL);
|
||||
adapter = PyDict_GetItemWithError(state->psyco_adapters, key);
|
||||
Py_DECREF(key);
|
||||
if (adapter) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue