3232#error "SQLite 3.7.15 or higher required"
3333#endif
3434
35- #define clinic_state () (pysqlite_get_state(NULL ))
35+ #define clinic_state () (pysqlite_get_state(module ))
3636#include "clinic/module.c.h"
3737#undef clinic_state
3838
@@ -41,8 +41,6 @@ module _sqlite3
4141[clinic start generated code]*/
4242/*[clinic end generated code: output=da39a3ee5e6b4b0d input=81e330492d57488e]*/
4343
44- pysqlite_state pysqlite_global_state ;
45-
4644// NOTE: This must equal sqlite3.Connection.__init__ argument spec!
4745/*[clinic input]
4846_sqlite3.connect as pysqlite_connect
@@ -160,7 +158,7 @@ pysqlite_register_adapter_impl(PyObject *module, PyTypeObject *type,
160158
161159 pysqlite_state * state = pysqlite_get_state (module );
162160 PyObject * protocol = (PyObject * )state -> PrepareProtocolType ;
163- rc = pysqlite_microprotocols_add (type , protocol , caster );
161+ rc = pysqlite_microprotocols_add (state , type , protocol , caster );
164162 if (rc == -1 ) {
165163 return NULL ;
166164 }
@@ -395,16 +393,11 @@ static int add_integer_constants(PyObject *module) {
395393 return ret ;
396394}
397395
398- static struct PyModuleDef _sqlite3module = {
399- PyModuleDef_HEAD_INIT ,
400- "_sqlite3" ,
401- NULL ,
402- -1 ,
403- module_methods ,
404- NULL ,
405- NULL ,
406- NULL ,
407- NULL
396+ struct PyModuleDef _sqlite3module = {
397+ .m_base = PyModuleDef_HEAD_INIT ,
398+ .m_name = "_sqlite3" ,
399+ .m_size = sizeof (pysqlite_state ),
400+ .m_methods = module_methods ,
408401};
409402
410403#define ADD_TYPE (module , type ) \
0 commit comments