]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix calling order of PyEval_InitThreads. (GH-5833)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Sep 2019 14:37:34 +0000 (07:37 -0700)
committerBenjamin Peterson <benjamin@python.org>
Tue, 10 Sep 2019 14:37:34 +0000 (15:37 +0100)
As described in Doc/c-api/init.rst, PyEval_InitThreads() cannot be called
before Py_Initialize() function.
(cherry picked from commit 9e61066355b4b55c873d56f5f106a22463b56862)

Co-authored-by: Kenta Murata <mrkn@users.noreply.github.com>
Modules/_ctypes/callbacks.c

index 5a8303fba290cbf32f525464b9c0023f51f4ad6d..a3d1c386b724a07277befaab5b7241a5bb49f6ed 100644 (file)
@@ -417,8 +417,8 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
 static void LoadPython(void)
 {
     if (!Py_IsInitialized()) {
-        PyEval_InitThreads();
         Py_Initialize();
+        PyEval_InitThreads();
     }
 }