From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 10 Sep 2019 14:37:34 +0000 (-0700) Subject: Fix calling order of PyEval_InitThreads. (GH-5833) X-Git-Tag: v3.7.5rc1~104 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fbe0ee5487055216c71596d694e323dbac02582;p=thirdparty%2FPython%2Fcpython.git Fix calling order of PyEval_InitThreads. (GH-5833) 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 --- diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 5a8303fba290..a3d1c386b724 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -417,8 +417,8 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, static void LoadPython(void) { if (!Py_IsInitialized()) { - PyEval_InitThreads(); Py_Initialize(); + PyEval_InitThreads(); } }