From ce03f8cb03186129f9f36b5469933267b0fc10d8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Nov 30 2020 14:01:28 +0000 Subject: Fix Python 3.10 compatibility Fix sbkstring.cpp ("static strings") of libshiboken for Python 3.10. On Python 3.10 and newer, finalizeStaticStrings() now uses regular Py_DECREF() rather than setthig the reference count to 1. Since Python 3.10, interned strings at deleted at Python exit. Resolves: rhbz#1902618 --- diff --git a/python-pyside2.spec b/python-pyside2.spec index 56fc59a..a46c579 100644 --- a/python-pyside2.spec +++ b/python-pyside2.spec @@ -16,7 +16,7 @@ Name: python-%{pypi_name} Epoch: 1 Version: 5.15.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Python bindings for the Qt 5 cross-platform application and UI framework License: BSD and GPLv2 and GPLv3 and LGPLv3 @@ -30,6 +30,8 @@ Patch0: pyside2-tools-obsolete.patch Patch1: python_ver_classifier.patch # setuptools --reuse-build option was broken in 5.15.2 Patch2: python-pyside2-options_py.patch +# Fix Python 3.10 compatibility (rhbz#1902618). +Patch3: python310.patch %if 0%{?rhel} == 7 BuildRequires: llvm-toolset-7-clang-devel llvm-toolset-7-llvm-devel @@ -271,6 +273,9 @@ pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{_bindir}/* %changelog +* Mon Nov 30 11:30:03 CET 2020 Victor Stinner - 1:5.15.2-2 +- Fix Python 3.10 compatibility (rhbz#1902618). + * Sat Nov 28 2020 Richard Shaw - 1:5.15.2-1 - Update to 5.15.2. diff --git a/python310.patch b/python310.patch new file mode 100644 index 0000000..3c9fbed --- /dev/null +++ b/python310.patch @@ -0,0 +1,18 @@ +--- ./sources/shiboken2/libshiboken/sbkstring.cpp.old 2020-11-30 11:17:34.217081554 +0100 ++++ ./sources/shiboken2/libshiboken/sbkstring.cpp 2020-11-30 11:24:47.908077166 +0100 +@@ -247,8 +247,15 @@ + { + auto &set = staticStrings(); + for (PyObject *ob : set) { ++ // Since Python 3.10, interned strings are deleted at Python exit. ++#if PY_VERSION_HEX >= 0x030a0000 ++ Py_DECREF(ob); ++ // createStaticString() calls Py_INCREF() ++ Py_DECREF(ob); ++#else + Py_REFCNT(ob) = 1; + Py_DECREF(ob); ++#endif + } + set.clear(); + }