void-packages/srcpkgs/zbar/patches/PyEval_InitThreads.patch

42 lines
1.4 KiB
Diff

From 923da762e890f8a4516e8d5ef1314ae84703ab5d Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date: Wed, 23 Dec 2020 11:56:08 +0100
Subject: [PATCH] python: get rid of a Python 3.9 warning
As mentioned on:
https://cpython-ericholscher.readthedocs.io/en/sphinx-hoverxref/whatsnew/3.9.html
The PyEval_InitThreads() and PyEval_ThreadsInitialized() functions are now
deprecated and will be removed in Python 3.11. Calling PyEval_InitThreads()
now does nothing. The GIL is initialized by Py_Initialize() since Python 3.7.
So, let's not call it on Python 3.9, in order to avoid a
warning noise.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
python/processor.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/python/processor.c b/python/processor.c
index 44e3a9d..52597df 100644
--- a/python/processor.c
+++ b/python/processor.c
@@ -43,11 +43,13 @@ processor_new (PyTypeObject *type,
return(NULL);
#ifdef WITH_THREAD
+# if (PY_MAJOR_VERSION < 3) || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9)
/* the processor creates a thread that calls back into python,
* so we must ensure that threads are initialized before attempting
* to manipulate the GIL (bug #3349199)
*/
PyEval_InitThreads();
+# endif
#else
if(threaded > 0 &&
PyErr_WarnEx(NULL, "threading requested but not available", 1))
--
2.38.0.rc0