diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-06-15 14:47:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 14:47:34 +0200 |
commit | 10a5c806d4dec6c342dcc9888fbe4fa1fa9b7a1f (patch) | |
tree | 8ed7c361bfa27d7b41bcab5a43c9ebc1957e7fd3 /Modules/_sqlite/module.h | |
parent | 8ebd9447e9618240ee3b955888d114376f64117b (diff) | |
download | cpython-10a5c806d4dec6c342dcc9888fbe4fa1fa9b7a1f.tar.gz cpython-10a5c806d4dec6c342dcc9888fbe4fa1fa9b7a1f.zip |
bpo-42064: Move sqlite3 types to global state (GH-26537)
* Move connection type to global state
* Move cursor type to global state
* Move prepare protocol type to global state
* Move row type to global state
* Move statement type to global state
* ADD_TYPE takes a pointer
* pysqlite_get_state is now static inline
Diffstat (limited to 'Modules/_sqlite/module.h')
-rw-r--r-- | Modules/_sqlite/module.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h index a40e86e9c4d..3f29035b5fe 100644 --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -31,9 +31,20 @@ typedef struct { PyObject *lru_cache; + PyTypeObject *ConnectionType; + PyTypeObject *CursorType; + PyTypeObject *PrepareProtocolType; + PyTypeObject *RowType; + PyTypeObject *StatementType; } pysqlite_state; -extern pysqlite_state *pysqlite_get_state(PyObject *module); +extern pysqlite_state pysqlite_global_state; + +static inline pysqlite_state * +pysqlite_get_state(PyObject *Py_UNUSED(module)) +{ + return &pysqlite_global_state; +} extern PyObject* pysqlite_Error; extern PyObject* pysqlite_Warning; |