From 21dacea6ad1c49e1cafbe8bac803ddc22a534274 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 10 Sep 2019 07:37:56 -0700 Subject: [PATCH] Fix calling order of PyEval_InitThreads. (GH-15836) 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 --- Modules/_ctypes/callbacks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 97463b599bc..d2d9a6587d7 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(); } }