public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/cutter-re] rawhide: Fix FTBFS with Python 3.16 rhbz#2584233
@ 2026-11-25 19:13 Filipe Rosset
  0 siblings, 0 replies; only message in thread
From: Filipe Rosset @ 2026-11-25 19:13 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/cutter-re
            Branch : rawhide
            Commit : b91ad9cabebf2945c16867b93c1a1835881573eb
            Author : Filipe Rosset <rosset.filipe@gmail.com>
            Date   : 2026-11-25T14:52:56-03:00
            Stats  : +40/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/cutter-re/c/b91ad9cabebf2945c16867b93c1a1835881573eb?branch=rawhide

            Log:
            Fix FTBFS with Python 3.16 rhbz#2584233

Py_SetPythonHome() removed in Python 3.16, PyEval_InitThreads() in 3.13

Signed-off-by: Filipe Rosset <rosset.filipe@gmail.com>

---
diff --git a/cutter-fix-build-against-python-3.16.patch b/cutter-fix-build-against-python-3.16.patch
new file mode 100644
index 0000000..ce0adb5
--- /dev/null
+++ b/cutter-fix-build-against-python-3.16.patch
@@ -0,0 +1,37 @@
+Subject: Fix build against Python 3.16
+
+Py_SetPythonHome() was removed in Python 3.16; PYTHONHOME is picked up
+from the environment only.
+
+PyEval_InitThreads() was removed in Python 3.13 and its existing version
+guard is broken (PY_MICRO_VERSION is not a C preprocessor macro, so the
+expression always evaluates true). Replace it with a correct
+PY_VERSION_HEX check.
+
+diff --git a/src/common/PythonManager.cpp b/src/common/PythonManager.cpp
+--- a/src/common/PythonManager.cpp
++++ b/src/common/PythonManager.cpp
+@@ -60,7 +60,11 @@ void PythonManager::initPythonHome()
+     if (!customPythonHome.isNull()) {
+         qInfo() << "PYTHONHOME =" << customPythonHome;
+         pythonHome = Py_DecodeLocale(customPythonHome.toLocal8Bit().constData(), nullptr);
++        // Py_SetPythonHome() was removed in Python 3.16; PYTHONHOME is
++        // picked up from the environment.
++#if PY_VERSION_HEX < 0x03100000
+         Py_SetPythonHome(pythonHome);
++#endif
+     }
+ }
+ 
+@@ -152,8 +156,9 @@ void PythonManager::initialize()
+     }
+ #    endif
+ #endif
+-    // This function is deprecated does nothing starting from Python 3.9
+-#if (PY_MAJOR_VERSION <= 3) && (PY_MICRO_VERSION < 9)
++    // PyEval_InitThreads() is a no-op starting from Python 3.9 and was
++    // removed in Python 3.13.
++#if PY_VERSION_HEX < 0x03090000
+     PyEval_InitThreads();
+ #endif
+     pyThreadStateCounter = 1; // we have the thread now => 1

diff --git a/cutter-re.spec b/cutter-re.spec
index aa89d51..6401cc0 100644
--- a/cutter-re.spec
+++ b/cutter-re.spec
@@ -20,6 +20,9 @@ Source2:        cutter-re.appdata.xml
 Patch0:         cutter-qt612-uic.patch
 # Fixed with help from LLMs
 Patch1:         cutter-fix-build-against-python-3.15.patch
+# Py_SetPythonHome() removed in Python 3.16, PyEval_InitThreads() in 3.13
+# https://bugzilla.redhat.com/show_bug.cgi?id=2584233
+Patch2:         cutter-fix-build-against-python-3.16.patch
 
 BuildRequires:  clang
 BuildRequires:  cmake

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-25 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 19:13 [rpms/cutter-re] rawhide: Fix FTBFS with Python 3.16 rhbz#2584233 Filipe Rosset

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox