diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-07-20 10:59:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 10:59:18 (GMT) |
commit | 4c0deb25ac899fbe4da626ce3cb21f204cdd3aa9 (patch) | |
tree | 4f2aa2801e9981d143d1f9a5dd543f2ea8579859 /Modules/_sqlite/cursor.c | |
parent | 366fcbac18e3adc41e3901580dbedb6a91e41a10 (diff) | |
download | cpython-4c0deb25ac899fbe4da626ce3cb21f204cdd3aa9.zip cpython-4c0deb25ac899fbe4da626ce3cb21f204cdd3aa9.tar.gz cpython-4c0deb25ac899fbe4da626ce3cb21f204cdd3aa9.tar.bz2 |
bpo-42064: Finalise establishing sqlite3 global state (GH-27155)
With this, all sqlite3 static globals have been moved to the global state.
There are a couple of global static strings left, but there should be no need for adding them to the state.
https://bugs.python.org/issue42064
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r-- | Modules/_sqlite/cursor.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 07202df..24b4a37 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -147,7 +147,8 @@ _pysqlite_get_converter(const char *keystr, Py_ssize_t keylen) return NULL; } - retval = PyDict_GetItemWithError(_pysqlite_converters, upcase_key); + pysqlite_state *state = pysqlite_get_state(NULL); + retval = PyDict_GetItemWithError(state->converters, upcase_key); Py_DECREF(upcase_key); return retval; @@ -469,6 +470,7 @@ get_statement_from_cache(pysqlite_Cursor *self, PyObject *operation) static PyObject * _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument) { + pysqlite_state *state = pysqlite_get_state(NULL); PyObject* parameters_list = NULL; PyObject* parameters_iter = NULL; PyObject* parameters = NULL; @@ -583,7 +585,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation if (rc != SQLITE_DONE && rc != SQLITE_ROW) { if (PyErr_Occurred()) { /* there was an error that occurred in a user-defined callback */ - if (_pysqlite_enable_callback_tracebacks) { + if (state->enable_callback_tracebacks) { PyErr_Print(); } else { PyErr_Clear(); |