https://github.com/python/cpython/commit/9e61066355b4b55c873d56f5f106a22463b56862 commit: 9e61066355b4b55c873d56f5f106a22463b56862 branch: master author: Kenta Murata <mrkn at users.noreply.github.com> committer: Benjamin Peterson <benjamin at python.org> date: 2019年09月10日T11:29:56+01:00 summary: 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. files: M Modules/_ctypes/callbacks.c diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 97463b599bc0..d2d9a6587d79 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(); } }