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
This commit is contained in:
Erlend Egeberg Aasland 2021-06-15 14:47:34 +02:00 committed by GitHub
parent 8ebd9447e9
commit 10a5c806d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 103 additions and 70 deletions

View file

@ -58,8 +58,8 @@ pysqlite_microprotocols_add(PyTypeObject *type, PyObject *proto, PyObject *cast)
PyObject* key;
int rc;
if (proto == NULL) proto = (PyObject*)pysqlite_PrepareProtocolType;
assert(type != NULL);
assert(proto != NULL);
key = Py_BuildValue("(OO)", (PyObject*)type, proto);
if (!key) {
return -1;
@ -81,7 +81,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
PyObject *adapter, *key, *adapted;
/* we don't check for exact type conformance as specified in PEP 246
because the pysqlite_PrepareProtocolType type is abstract and there is no
because the PrepareProtocolType type is abstract and there is no
way to get a quotable object to be its instance */
/* look for an adapter in the registry */