#7 Fix Python 3.10 compatibility
Closed 4 years ago by hobbes1069. Opened 5 years ago by vstinner.
rpms/ vstinner/python-pyside2 python310  into  rawhide

Fix Python 3.10 compatibility
Victor Stinner • 5 years ago  
file modified
+6 -1
@@ -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 @@ 

  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 @@ 

  

  

  %changelog

+ * Mon Nov 30 11:30:03 CET 2020 Victor Stinner <vstinner@python.org> - 1:5.15.2-2

+ - Fix Python 3.10 compatibility (rhbz#1902618).

+ 

  * Sat Nov 28 2020 Richard Shaw <hobbes1069@gmail.com> - 1:5.15.2-1

  - Update to 5.15.2.

  

file added
+18
@@ -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.

"internal strings", not "interned"

+ +#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();

+  }

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

I'm currently building this PR locally using the Python 3.10 COPR to test it.

I'm trying to report the issue to upstream https://bugreports.qt.io/ I created an account but I didn't get the email to validate my email address yet...

I'm currently building this PR locally using the Python 3.10 COPR to test it.

It completed successfully. The package doesn't run any test (tests are disabled explicitly ("Lots of tests fail currently").

There is an on-going COPR build as well: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/1806613/

I'm trying to report the issue to upstream https://bugreports.qt.io/ I created an account but I didn't get the email to validate my email address yet...

I got the confirmation email and created:
https://bugreports.qt.io/browse/PYSIDE-1436

While unlikely to cause issues, have you attempted a build for F33 to make sure nothing breaks? I'm not worried about F32 since it's still on Qt 5.14.x.

There seem to be typos in that sentence. Maybe "internal strings are deleted"?

rebased onto ce03f8c

5 years ago

This PR unblocked the Python 3.10 COPR. Maybe wait a few days until the patch is merged upstream? See https://bugreports.qt.io/browse/PYSIDE-1436

There seem to be typos in that sentence. Maybe "internal strings are deleted"?

Oops right, fixed ;-)

"internal strings", not "interned"

Python uses the term "interned", see: https://docs.python.org/dev/library/sys.html#sys.intern

Objects/unicodeobject.c uses SSTATE_INTERNED_MORTAL and SSTATE_INTERNED_IMMORTAL flags.

Upstream is moving slow. If you can update your pull request so it can be merged I'll go ahead and do that.

Miro has submitted a new PR that fixes builds so I'll close this one.

Pull-Request has been closed by hobbes1069

4 years ago