Backport patches needed for compatibility with Python 3.12

This commit is contained in:
Tomáš Hrnčiar 2023-06-21 14:57:52 +02:00
parent 2ef29fc5bb
commit 36c621013e
3 changed files with 75 additions and 2 deletions

View File

@ -0,0 +1,29 @@
From 8d7bede5ac43fad34383c7a507fdf7f8fb6a5c68 Mon Sep 17 00:00:00 2001
From: Phil Thompson <phil@riverbankcomputing.com>
Date: Wed, 21 Jun 2023 14:38:45 +0200
Subject: [PATCH] For Python v3.12 implement sipPyTypeDict() using
PyType_GetDict().
---
sip_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sip_core.c b/sip_core.c
index a51513f..7203bce 100644
--- a/sip_core.c
+++ b/sip_core.c
@@ -11112,7 +11112,11 @@ static void *sip_api_get_type_user_data(const sipWrapperType *wt)
*/
static PyObject *sip_api_py_type_dict(const PyTypeObject *py_type)
{
+#if PY_VERSION_HEX >= 0x030c0000
+ return PyType_GetDict(py_type);
+#else
return py_type->tp_dict;
+#endif
}
--
2.40.1

View File

@ -6,12 +6,17 @@
Name: python-%{pkg_name}
Version: 13.4.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The sip module support for PyQt6
License: GPLv2 or GPLv3
URL: https://www.riverbankcomputing.com/software/sip/
Source0: %{pypi_source}
# Patches needed for compatibility with Python 3.12
# https://www.riverbankcomputing.com/hg/sip/rev/312476401030
Patch: sipMalloc-and-sipFree-are-now-implemented-using-PyMe.patch
# https://www.riverbankcomputing.com/hg/sip/rev/d36867e54192
Patch: For-Python-v3.12-implement-sipPyTypeDict-using-PyTyp.patch
BuildRequires: gcc
BuildRequires: python3-devel
@ -32,7 +37,7 @@ Provides: python3-pyqt6-sip-api(%{_sip_api_major})%{?_isa} = %{_sip_api}
%description -n python3-%{pkg_name} %_description
%prep
%autosetup -n %{pypi_name}-%{version}
%autosetup -p1 -n %{pypi_name}-%{version}
%build
@ -51,6 +56,9 @@ Provides: python3-pyqt6-sip-api(%{_sip_api_major})%{?_isa} = %{_sip_api}
%changelog
* Wed Jun 21 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 13.4.0-4
- Backport patches needed for compatibility with Python 3.12
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 13.4.0-3
- Rebuilt for Python 3.12

View File

@ -0,0 +1,36 @@
From 9c13eac1177f90a44f811f265ea8e4caa41879c9 Mon Sep 17 00:00:00 2001
From: Phil Thompson <phil@riverbankcomputing.com>
Date: Wed, 21 Jun 2023 14:30:26 +0200
Subject: [PATCH] sipMalloc() and sipFree() are now implemented using
PyMem_RawMalloc() and PyMem_RawFree() so that they should be safe to call
from functions registered with Py_AtExit().
---
sip_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sip_core.c b/sip_core.c
index f763090..a51513f 100644
--- a/sip_core.c
+++ b/sip_core.c
@@ -1886,7 +1886,7 @@ void *sip_api_malloc(size_t nbytes)
{
void *mem;
- if ((mem = PyMem_Malloc(nbytes)) == NULL)
+ if ((mem = PyMem_RawMalloc(nbytes)) == NULL)
PyErr_NoMemory();
return mem;
@@ -1898,7 +1898,7 @@ void *sip_api_malloc(size_t nbytes)
*/
void sip_api_free(void *mem)
{
- PyMem_Free(mem);
+ PyMem_RawFree(mem);
}
--
2.40.1