commit:     d7112b95563c48b2bce8588c70a940b841cc7f72
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 31 16:20:00 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 31 16:35:29 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7112b95

dev-python/greenlet: Skip leak checks

Skip checking for leaks and running leak checks in the ebuild.
They are slow, technically fragile and only really reliable for upstream
testing.  And they crash on JIT builds.

Bug: https://github.com/python-greenlet/greenlet/issues/455
Pull-Request: https://github.com/python-greenlet/greenlet/pull/461
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/greenlet-3.2.3-skip-leak-tests.patch     | 51 ++++++++++++++++++++++
 dev-python/greenlet/greenlet-3.2.3.ebuild          |  3 ++
 2 files changed, 54 insertions(+)

diff --git a/dev-python/greenlet/files/greenlet-3.2.3-skip-leak-tests.patch 
b/dev-python/greenlet/files/greenlet-3.2.3-skip-leak-tests.patch
new file mode 100644
index 000000000000..3e7ea3a55f27
--- /dev/null
+++ b/dev-python/greenlet/files/greenlet-3.2.3-skip-leak-tests.patch
@@ -0,0 +1,51 @@
+From cfb846272ab94a79c2f936da13dc3f5213f48912 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 31 Jul 2025 18:16:00 +0200
+Subject: [PATCH] Skip `TestLeaks` when `GREENLET_SKIP_LEAKCHECKS` is used
+
+When `GREENLET_SKIP_LEAKCHECKS` is used, we do not want to check for
+leaks, and therefore it makes no sense to run tests explicitly checking
+for leaks.  Since the conditional is also true for MANYLINUX builds,
+remove the redundant condition.
+---
+ src/greenlet/tests/test_leaks.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/greenlet/tests/test_leaks.py 
b/src/greenlet/tests/test_leaks.py
+index 99da4eb..fe60fa2 100644
+--- a/src/greenlet/tests/test_leaks.py
++++ b/src/greenlet/tests/test_leaks.py
+@@ -10,6 +10,7 @@
+ import time
+ import weakref
+ import threading
++import unittest
+ 
+ 
+ import greenlet
+@@ -17,7 +18,7 @@
+ from . import PY314
+ from .leakcheck import fails_leakcheck
+ from .leakcheck import ignores_leakcheck
+-from .leakcheck import RUNNING_ON_MANYLINUX
++from .leakcheck import SKIP_LEAKCHECKS
+ 
+ # pylint:disable=protected-access
+ 
+@@ -39,6 +40,7 @@ def reset(cls):
+         cls.EXTANT_INSTANCES.clear()
+ 
+ 
[email protected](SKIP_LEAKCHECKS, "Leak checks disabled")
+ class TestLeaks(TestCase):
+ 
+     def test_arg_refs(self):
+@@ -313,8 +315,6 @@ def _only_test_some_versions(self):
+         assert sys.version_info[0] >= 3
+         if sys.version_info[:2] < (3, 8):
+             self.skipTest('Only observed on 3.11')
+-        if RUNNING_ON_MANYLINUX:
+-            self.skipTest("Slow and not worth repeating here")
+ 
+     @ignores_leakcheck
+     # Because we're just trying to track raw memory, not objects, and running

diff --git a/dev-python/greenlet/greenlet-3.2.3.ebuild 
b/dev-python/greenlet/greenlet-3.2.3.ebuild
index 43decd360058..da23cd7070cd 100644
--- a/dev-python/greenlet/greenlet-3.2.3.ebuild
+++ b/dev-python/greenlet/greenlet-3.2.3.ebuild
@@ -38,6 +38,8 @@ src_prepare() {
        local PATCHES=(
                # https://github.com/python-greenlet/greenlet/pull/457
                "${FILESDIR}/${P}-py312-assert.patch"
+               # https://github.com/python-greenlet/greenlet/pull/461
+               "${FILESDIR}/${P}-skip-leak-tests.patch"
        )
 
        distutils-r1_src_prepare
@@ -47,5 +49,6 @@ src_prepare() {
 }
 
 python_test() {
+       local -x GREENLET_SKIP_LEAKCHECKS=1
        eunittest greenlet.tests
 }

Reply via email to