]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
ChangeLog: python: Fix compile-time errors about deprecation via ifdefs. 3886/head
authorPaul <itsascambutmailmeanyway@gmail.com>
Fri, 18 Jun 2021 12:48:29 +0000 (14:48 +0200)
committerPaul <itsascambutmailmeanyway@gmail.com>
Fri, 18 Jun 2021 12:52:12 +0000 (14:52 +0200)
src/python.c

index 119ffe21742ab20d8909c45c23c000e7ae3a67e9..318883ecfff1e3164585baeec68ab57ded1ef974 100644 (file)
@@ -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, "<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