diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-09-07 16:56:24 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-09-07 16:56:24 (GMT) |
commit | a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 (patch) | |
tree | 1c31738009bee903417cea928e705a112aea2392 /Modules/_sqlite/connection.c | |
parent | 1f06a680de465be0c24a78ea3b610053955daa99 (diff) | |
download | cpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.zip cpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.gz cpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.bz2 |
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r-- | Modules/_sqlite/connection.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index e2ba758..f596bcf 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -170,9 +170,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject self->detect_types = detect_types; self->timeout = timeout; (void)sqlite3_busy_timeout(self->db, (int)(timeout*1000)); -#ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); -#endif if (!check_same_thread && sqlite3_libversion_number() < 3003001) { PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); return -1; @@ -592,11 +590,9 @@ void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** PyObject* py_retval = NULL; int ok; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif py_func = (PyObject*)sqlite3_user_data(context); @@ -620,9 +616,7 @@ void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** _sqlite3_result_error(context, "user-defined function raised exception", -1); } -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif } static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_value** params) @@ -633,11 +627,9 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ PyObject** aggregate_instance; PyObject* stepmethod = NULL; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif aggregate_class = (PyObject*)sqlite3_user_data(context); @@ -684,9 +676,7 @@ error: Py_XDECREF(stepmethod); Py_XDECREF(function_result); -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif } void _pysqlite_final_callback(sqlite3_context* context) @@ -698,11 +688,9 @@ void _pysqlite_final_callback(sqlite3_context* context) PyObject *exception, *value, *tb; int restore; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); if (!*aggregate_instance) { @@ -746,12 +734,7 @@ void _pysqlite_final_callback(sqlite3_context* context) } error: -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif - /* explicit return to avoid a compilation error if WITH_THREAD - is not defined */ - return; } static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self) @@ -884,11 +867,9 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co { PyObject *ret; int rc; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source); @@ -917,9 +898,7 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co Py_DECREF(ret); } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return rc; } @@ -927,11 +906,9 @@ static int _progress_handler(void* user_arg) { int rc; PyObject *ret; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif ret = _PyObject_CallNoArg((PyObject*)user_arg); if (!ret) { @@ -948,9 +925,7 @@ static int _progress_handler(void* user_arg) Py_DECREF(ret); } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return rc; } @@ -959,11 +934,9 @@ static void _trace_callback(void* user_arg, const char* statement_string) PyObject *py_statement = NULL; PyObject *ret = NULL; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif py_statement = PyUnicode_DecodeUTF8(statement_string, strlen(statement_string), "replace"); if (py_statement) { @@ -981,9 +954,7 @@ static void _trace_callback(void* user_arg, const char* statement_string) } } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif } static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) @@ -1120,7 +1091,6 @@ static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* ar int pysqlite_check_thread(pysqlite_Connection* self) { -#ifdef WITH_THREAD if (self->check_same_thread) { if (PyThread_get_thread_ident() != self->thread_ident) { PyErr_Format(pysqlite_ProgrammingError, @@ -1131,7 +1101,6 @@ int pysqlite_check_thread(pysqlite_Connection* self) } } -#endif return 1; } @@ -1365,15 +1334,11 @@ pysqlite_collation_callback( PyObject* callback = (PyObject*)context; PyObject* string1 = 0; PyObject* string2 = 0; -#ifdef WITH_THREAD PyGILState_STATE gilstate; -#endif PyObject* retval = NULL; long longval; int result = 0; -#ifdef WITH_THREAD gilstate = PyGILState_Ensure(); -#endif if (PyErr_Occurred()) { goto finally; @@ -1409,9 +1374,7 @@ finally: Py_XDECREF(string1); Py_XDECREF(string2); Py_XDECREF(retval); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return result; } |