From: Kenta Murata Date: Tue, 10 Sep 2019 10:29:56 +0000 (+0900) Subject: Fix calling order of PyEval_InitThreads. (GH-4602) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e61066355b4b55c873d56f5f106a22463b56862;p=python Fix calling order of PyEval_InitThreads. (GH-4602) As described in Doc/c-api/init.rst, PyEval_InitThreads() cannot be called before Py_Initialize() function. --- diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 97463b599b..d2d9a6587d 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -422,8 +422,8 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, static void LoadPython(void) { if (!Py_IsInitialized()) { - PyEval_InitThreads(); Py_Initialize(); + PyEval_InitThreads(); } }