diff options
| author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-06-12 16:33:14 +0300 |
|---|---|---|
| committer | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-06-12 16:35:19 +0300 |
| commit | 87ca2082630fa9cb9e9f06b6c8e8e6eabc1c19c9 (patch) | |
| tree | 7d1383abaa5248a0a3d7a4783fa3425742e2c9a0 /plugins | |
| parent | ca8bc6acc98b2c062b5b00668acd851e210fcbca (diff) | |
| download | uwsgi-87ca2082630fa9cb9e9f06b6c8e8e6eabc1c19c9.tar.gz | |
Use threading.current_thread, has existed since Python 2.6
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/python/python_plugin.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index ecdf2192..91e3537f 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -1423,16 +1423,12 @@ void uwsgi_python_enable_threads() { } void uwsgi_python_set_thread_name(int core_id) { - // call threading.currentThread (taken from mod_wsgi, but removes DECREFs as thread in uWSGI are fixed) + // call threading.current_thread (taken from mod_wsgi, but removes DECREFs as thread in uWSGI are fixed) PyObject *threading_module = PyImport_ImportModule("threading"); if (threading_module) { PyObject *threading_module_dict = PyModule_GetDict(threading_module); if (threading_module_dict) { -#ifdef PYTHREE PyObject *threading_current = PyDict_GetItemString(threading_module_dict, "current_thread"); -#else - PyObject *threading_current = PyDict_GetItemString(threading_module_dict, "currentThread"); -#endif if (threading_current) { PyObject *current_thread = PyObject_CallObject(threading_current, (PyObject *)NULL); if (!current_thread) { @@ -1516,11 +1512,7 @@ PyObject *uwsgi_python_setup_thread(char *name, PyInterpreterState *interpreter) if (threading_module) { PyObject *threading_module_dict = PyModule_GetDict(threading_module); if (threading_module_dict) { -#ifdef PYTHREE PyObject *threading_current = PyDict_GetItemString(threading_module_dict, "current_thread"); -#else - PyObject *threading_current = PyDict_GetItemString(threading_module_dict, "currentThread"); -#endif if (threading_current) { PyObject *current_thread = PyObject_CallObject(threading_current, (PyObject *)NULL); if (!current_thread) { |
