public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: dev-python/guppy3/, dev-python/guppy3/files/
@ 2023-05-22 23:14 YiFei Zhu
  0 siblings, 0 replies; only message in thread
From: YiFei Zhu @ 2023-05-22 23:14 UTC (permalink / raw
  To: gentoo-commits

commit:     1c62f2e44056fd5e741cdff56e3983352b2a668c
Author:     YiFei Zhu <zhuyifei1999 <AT> gmail <DOT> com>
AuthorDate: Mon May 22 23:12:54 2023 +0000
Commit:     YiFei Zhu <zhuyifei1999 <AT> gmail <DOT> com>
CommitDate: Mon May 22 23:14:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1c62f2e4

dev-python/guppy3: Fix assertion on USE=debug

Applied patch upstream.

Closes: https://bugs.gentoo.org/906937
Signed-off-by: YiFei Zhu <zhuyifei1999 <AT> gmail.com>

 .../files/guppy3-3.1.3-py311-refcount-assert.patch | 44 ++++++++++++++++++++++
 ...{guppy3-3.1.3.ebuild => guppy3-3.1.3-r1.ebuild} |  4 ++
 2 files changed, 48 insertions(+)

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
similarity index 88%
rename from dev-python/guppy3/guppy3-3.1.3.ebuild
rename to 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-22 23:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22 23:14 [gentoo-commits] repo/proj/guru:dev commit in: dev-python/guppy3/, dev-python/guppy3/files/ YiFei Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox