summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLingMan2023-05-10 21:47:26 +0200
committerLingMan2023-05-10 21:47:26 +0200
commit9987c7b552d02cd59b50fafb2abd888ee3165dd4 (patch)
treeeaceee75ca9d6a1d57b543de3ddacc7ee602080d
parentcdec96104315fb719d2cf89ae89c1cc6bbe56069 (diff)
downloadaur-9987c7b552d02cd59b50fafb2abd888ee3165dd4.tar.gz
Fix compilation against Python 3.11+
-rw-r--r--.SRCINFO5
-rw-r--r--0001-Fix-compilation-against-Python-3.11.patch50
-rw-r--r--PKGBUILD11
3 files changed, 61 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 498d9b2e2466..50937658b78c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,15 @@
pkgbase = python-sip-pyqt4
pkgver = 4.19.25
- pkgrel = 1
+ pkgrel = 2
url = https://www.riverbankcomputing.com/software/sip/intro
arch = x86_64
license = custom:"sip"
makedepends = python
makedepends = python2
source = https://www.riverbankcomputing.com/static/Downloads/sip/4.19.25/sip-4.19.25.tar.gz
+ source = 0001-Fix-compilation-against-Python-3.11.patch
sha256sums = b39d93e937647807bac23579edbff25fe46d16213f708370072574ab1f1b4211
+ sha256sums = 56ebacabe7f7fade875256ef19f835dc8ecc6bec080802403669352128059fbd
pkgname = python-sip-pyqt4
pkgdesc = Python 3.x SIP bindings for C and C++ libraries (PyQt4 version)
@@ -16,4 +18,3 @@ pkgname = python-sip-pyqt4
pkgname = python2-sip-pyqt4
pkgdesc = Python 2.x SIP bindings for C and C++ libraries (PyQt4 version)
depends = python2
-
diff --git a/0001-Fix-compilation-against-Python-3.11.patch b/0001-Fix-compilation-against-Python-3.11.patch
new file mode 100644
index 000000000000..a7412f77d971
--- /dev/null
+++ b/0001-Fix-compilation-against-Python-3.11.patch
@@ -0,0 +1,50 @@
+From a9c9e69ed89b481b7361d9aa4c1acbbd50e13e22 Mon Sep 17 00:00:00 2001
+From: LingMan <LingMan@users.noreply.github.com>
+Date: Wed, 10 May 2023 20:53:10 +0200
+Subject: [PATCH] Fix compilation against Python 3.11+
+
+With Python 3.11 the internal structure of PyFrameObject (AKA struct _frame) has been removed from
+the public API.
+De jure it was always an opaque struct but now there have also been de facto changes.
+
+From the sip side the change is simply to call the official PyFrame_GetBack API, but PyFrameObject
+is returned as part of sip's API. Callers of `sip_api_get_frame` may thus need additional fixes if
+they rely on PyFrameObject's internal structure.
+
+This change contains a fallback implementation of PyFrame_GetBack for Python 3.8 and older
+(including 2.7) as documented here:
+https://docs.python.org/3/whatsnew/3.11.html#whatsnew311-c-api-porting
+---
+ siplib/siplib.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/siplib/siplib.c b/siplib/siplib.c
+index db52b68..b234a0b 100644
+--- a/siplib/siplib.c
++++ b/siplib/siplib.c
+@@ -13737,6 +13737,13 @@ static int sip_api_is_user_type(const sipWrapperType *wt)
+ return wt->wt_user_type;
+ }
+
++#if PY_VERSION_HEX < 0x030900B1
++static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
++{
++ Py_XINCREF(frame->f_back);
++ return frame->f_back;
++}
++#endif
+
+ /*
+ * Return a frame from the execution stack.
+@@ -13747,7 +13754,7 @@ static struct _frame *sip_api_get_frame(int depth)
+
+ while (frame != NULL && depth > 0)
+ {
+- frame = frame->f_back;
++ frame = PyFrame_GetBack(frame);
+ --depth;
+ }
+
+--
+2.40.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 35c30381c8b6..5492b3a2d76d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,16 +8,21 @@
pkgbase='python-sip-pyqt4'
pkgname=('python-sip-pyqt4' 'python2-sip-pyqt4')
pkgver=4.19.25
-pkgrel=1
+pkgrel=2
arch=('x86_64')
url='https://www.riverbankcomputing.com/software/sip/intro'
license=('custom:"sip"')
makedepends=('python' 'python2')
-source=("https://www.riverbankcomputing.com/static/Downloads/sip/$pkgver/sip-$pkgver.tar.gz")
-sha256sums=('b39d93e937647807bac23579edbff25fe46d16213f708370072574ab1f1b4211')
+source=("https://www.riverbankcomputing.com/static/Downloads/sip/$pkgver/sip-$pkgver.tar.gz"
+ '0001-Fix-compilation-against-Python-3.11.patch')
+sha256sums=('b39d93e937647807bac23579edbff25fe46d16213f708370072574ab1f1b4211'
+ '56ebacabe7f7fade875256ef19f835dc8ecc6bec080802403669352128059fbd')
prepare() {
mkdir -p build-pyqt4{,-py2}
+
+ cd "$srcdir"/sip-$pkgver
+ patch --strip=1 --input=../0001-Fix-compilation-against-Python-3.11.patch
}
build() {