summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/module.h
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-07-29 09:21:45 (GMT)
committerGitHub <noreply@github.com>2021-07-29 09:21:45 (GMT)
commitd542742128b634264d5b6796297613975211b43b (patch)
treee541d59593fe7df7bd96367d60ac96b1e7e76606 /Modules/_sqlite/module.h
parent47fd4726a2ce8599cc397ddeae40f70eb471e868 (diff)
downloadcpython-d542742128b634264d5b6796297613975211b43b.zip
cpython-d542742128b634264d5b6796297613975211b43b.tar.gz
cpython-d542742128b634264d5b6796297613975211b43b.tar.bz2
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
Diffstat (limited to 'Modules/_sqlite/module.h')
-rw-r--r--Modules/_sqlite/module.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h
index 1344490..a286739 100644
--- a/Modules/_sqlite/module.h
+++ b/Modules/_sqlite/module.h
@@ -65,6 +65,19 @@ extern pysqlite_state pysqlite_global_state;
static inline pysqlite_state *
pysqlite_get_state(PyObject *Py_UNUSED(module))
{
+ return &pysqlite_global_state; // Replace with PyModule_GetState
+}
+
+static inline pysqlite_state *
+pysqlite_get_state_by_cls(PyTypeObject *Py_UNUSED(cls))
+{
+ return &pysqlite_global_state; // Replace with PyType_GetModuleState
+}
+
+static inline pysqlite_state *
+pysqlite_get_state_by_type(PyTypeObject *Py_UNUSED(tp))
+{
+ // Replace with _PyType_GetModuleByDef & PyModule_GetState
return &pysqlite_global_state;
}