From 809a4c45463e9d6210022152005af339e3a6c376 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 28 Oct 2026 08:10:52 -0700 Subject: [PATCH] python3-objgraph: Fix intermittent test_at_addrs ptest failure get_new_ids() keeps the ids it saw in earlier calls, including those of objects freed since. When the list created by test_at_addrs reuses one of those addresses it is not reported as new and the test fails, which was seen on musl qemux86-64: {'python3-objgraph': ['tests.py:AtAddrsTest.test_at_addrs']} Refresh the baseline right before creating the list. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj --- ...rs-independent-of-earlier-get_new_id.patch | 42 +++++++++++++++++++ .../python/python3-objgraph_3.7.0.bb | 4 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 meta-python/recipes-devtools/python/python3-objgraph/0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch diff --git a/meta-python/recipes-devtools/python/python3-objgraph/0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch b/meta-python/recipes-devtools/python/python3-objgraph/0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch new file mode 100644 index 0000000000..15c7458492 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-objgraph/0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 28 Oct 2026 08:08:23 -0700 +Subject: [PATCH] Make test_at_addrs independent of earlier get_new_ids() calls + +get_new_ids() keeps the ids it has seen in its _state and reports only +ids that are not in there. Ids of objects that were freed after an +earlier call stay in that set, so if the list created by test_at_addrs +reuses the address of one of them it is not reported as new and the +test fails: + + self.assertIn(a, new_lists) + AssertionError: [0, 1, 2] not found in [...] + +Whether that happens depends on the allocator and on what ran before; +it was seen intermittently with musl, and a slight change in what the +test allocates makes it fail every time. + +Call get_new_ids() once more right before creating the list, as the +example in its docstring does, so the baseline only holds live objects. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + tests.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests.py b/tests.py +index 0c7aa1f..1dab8c1 100755 +--- a/tests.py ++++ b/tests.py +@@ -361,6 +361,10 @@ class ByTypeTest(GarbageCollectedMixin, unittest.TestCase): + class AtAddrsTest(unittest.TestCase): + + def test_at_addrs(self): ++ # get_new_ids() remembers the ids seen by earlier calls, including ++ # ones of objects that have been freed since; refresh that state so ++ # that a list reusing such an address still counts as new. ++ objgraph.get_new_ids(limit=0) + a = [0, 1, 2] + new_ids = objgraph.get_new_ids(limit=0) + new_lists = objgraph.at_addrs(new_ids['list']) diff --git a/meta-python/recipes-devtools/python/python3-objgraph_3.7.0.bb b/meta-python/recipes-devtools/python/python3-objgraph_3.7.0.bb index 9ddfe97f53..f4098272ec 100644 --- a/meta-python/recipes-devtools/python/python3-objgraph_3.7.0.bb +++ b/meta-python/recipes-devtools/python/python3-objgraph_3.7.0.bb @@ -3,7 +3,9 @@ HOMEPAGE = "https://mg.pov.lt/objgraph/" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=e48a556235f55ad7d4234475657f68a7" -SRC_URI:append = " file://run-ptest" +SRC_URI:append = " file://run-ptest \ + file://0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch \ + " SRC_URI[sha256sum] = "b6ef4b244217410509b257970413b01a979d54df48d2d4055b6941e8679ddbbb" inherit pypi setuptools3 ptest-python-pytest