43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
From 17d2fbe443b656bb0f74c204eb003cea22f94e60 Mon Sep 17 00:00:00 2001
|
|
From: Paul <itsascambutmailmeanyway@gmail.com>
|
|
Date: Fri, 18 Jun 2021 14:48:29 +0200
|
|
Subject: [PATCH] ChangeLog: python: Fix compile-time errors about deprecation
|
|
via ifdefs.
|
|
|
|
---
|
|
src/python.c | 12 ++++++++++++
|
|
1 file changed, 12 insertions(+)
|
|
|
|
diff --git a/src/python.c b/src/python.c
|
|
index 119ffe21742..318883ecfff 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, "<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
|