aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiFei Zhu <zhuyifei1999@gmail.com>2023-05-22 16:12:54 -0700
committerYiFei Zhu <zhuyifei1999@gmail.com>2023-05-22 16:14:35 -0700
commit1c62f2e44056fd5e741cdff56e3983352b2a668c (patch)
tree0de17e8767e24b9f091b62f3780566c534973b97
parentdev-util/hut: new package, add 0.3.0 (diff)
downloadguru-1c62f2e4.tar.gz
guru-1c62f2e4.tar.bz2
guru-1c62f2e4.zip
dev-python/guppy3: Fix assertion on USE=debug
Applied patch upstream. Closes: https://bugs.gentoo.org/906937 Signed-off-by: YiFei Zhu <zhuyifei1999@gmail.com>
-rw-r--r--dev-python/guppy3/files/guppy3-3.1.3-py311-refcount-assert.patch44
-rw-r--r--dev-python/guppy3/guppy3-3.1.3-r1.ebuild (renamed from dev-python/guppy3/guppy3-3.1.3.ebuild)4
2 files changed, 48 insertions, 0 deletions
diff --git a/dev-python/guppy3/files/guppy3-3.1.3-py311-refcount-assert.patch b/dev-python/guppy3/files/guppy3-3.1.3-py311-refcount-assert.patch
new file mode 100644
index 000000000..8a8840d55
--- /dev/null
+++ b/dev-python/guppy3/files/guppy3-3.1.3-py311-refcount-assert.patch
@@ -0,0 +1,44 @@
+From 71f3455f73eedef78ccf79c17ed5adbb36d11eeb Mon Sep 17 00:00:00 2001
+From: YiFei Zhu <zhuyifei1999@gmail.com>
+Date: Mon, 22 May 2023 15:54:24 -0700
+Subject: [PATCH] nodegraph: Fix refcount sanity assertion for Python 3.11
+
+Python 3.11 created immortal objects whose initial refcount is
+999999999, larger than 0xa000000. This breaks the assertin here.
+
+Caught by https://bugs.gentoo.org/906937
+
+Fortunately I don't seem to need to do a new release with this fix
+because the wheels are built with -DNDEBUG.
+---
+ src/heapy/nodegraph.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/src/heapy/nodegraph.c b/src/heapy/nodegraph.c
+index 2fd9c83..765f5ee 100644
+--- a/src/heapy/nodegraph.c
++++ b/src/heapy/nodegraph.c
+@@ -148,8 +148,18 @@ NyNodeGraph_AddEdge(NyNodeGraphObject *ng, PyObject *src, PyObject *tgt)
+ ng->edges[ng->used_size-1].tgt == tgt)
+ return 0;
+
+- assert(Py_REFCNT(src) < 0xa000000 && (Py_uintptr_t)Py_TYPE(src) > 0x1000);
+- assert(Py_REFCNT(tgt) < 0xa000000 && (Py_uintptr_t)Py_TYPE(tgt) > 0x1000);
++#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
++ /* Py >= 3.11 _PyObject_IMMORTAL_INIT sets initial refcount of 999999999 */
++ assert((Py_uintptr_t)Py_TYPE(src) > 0x1000 &&
++ (Py_REFCNT(src) < 0xa000000 ||
++ (Py_REFCNT(src) >= 999999999 && Py_REFCNT(src) < 999999999 + 0xa000000)));
++ assert((Py_uintptr_t)Py_TYPE(tgt) > 0x1000 &&
++ (Py_REFCNT(tgt) < 0xa000000 ||
++ (Py_REFCNT(tgt) >= 999999999 && Py_REFCNT(tgt) < 999999999 + 0xa000000)));
++#else
++ assert((Py_uintptr_t)Py_TYPE(src) > 0x1000 && Py_REFCNT(src) < 0xa000000);
++ assert((Py_uintptr_t)Py_TYPE(tgt) > 0x1000 && Py_REFCNT(tgt) < 0xa000000);
++#endif
+
+ if (ng->used_size >= ng->allo_size) {
+ Py_ssize_t allo = roundupsize(ng->used_size + 1);
+--
+2.40.1
+
diff --git a/dev-python/guppy3/guppy3-3.1.3.ebuild b/dev-python/guppy3/guppy3-3.1.3-r1.ebuild
index cadaab1a5..fc3048258 100644
--- a/dev-python/guppy3/guppy3-3.1.3.ebuild
+++ b/dev-python/guppy3/guppy3-3.1.3-r1.ebuild
@@ -18,6 +18,10 @@ LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
+PATCHES=(
+ "${FILESDIR}"/guppy3-3.1.3-py311-refcount-assert.patch
+)
+
python_test() {
cd "${T}" || die
"${EPYTHON}" "${S}"/guppy/heapy/test/test_all.py || die