From: Paul Date: Fri, 18 Jun 2021 12:48:29 +0000 (+0200) Subject: ChangeLog: python: Fix compile-time errors about deprecation via ifdefs. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17d2fbe443b656bb0f74c204eb003cea22f94e60;p=thirdparty%2Fcollectd.git ChangeLog: python: Fix compile-time errors about deprecation via ifdefs. --- diff --git a/src/python.c b/src/python.c index 119ffe217..318883ecf 100644 --- a/src/python.c +++ b/src/python.c @@ -1141,7 +1141,13 @@ static void *cpy_interactive(void *pipefd) { #else PyOS_AfterFork_Child(); #endif +#if PY_VERSION_HEX < 0x03090000 + // deprecated. Called by Py_Initialize(). Removed in Py3.11 + // https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads PyEval_InitThreads(); +#else + Py_Initialize(); +#endif close(*(int *)pipefd); PyRun_InteractiveLoop(stdin, ""); PyOS_setsig(SIGINT, cur_sig); @@ -1178,7 +1184,13 @@ static int cpy_init(void) { ; (void)close(pipefd[0]); } else { +#if PY_VERSION_HEX < 0x03090000 + // deprecated. Called by Py_Initialize(). Removed in Py3.11 + // https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads PyEval_InitThreads(); +#else + Py_Initialize(); +#endif state = PyEval_SaveThread(); } CPY_LOCK_THREADS