mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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
This commit is contained in:
parent
366fcbac18
commit
4c0deb25ac
6 changed files with 69 additions and 53 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue