Skip to content

Fixing regression test for #517 so it fails on macos too#522

Merged
jamadden merged 1 commit into
python-greenlet:masterfrom
ddorian:c-stack-refs-test-detection
Jul 23, 2026
Merged

Fixing regression test for #517 so it fails on macos too#522
jamadden merged 1 commit into
python-greenlet:masterfrom
ddorian:c-stack-refs-test-detection

Conversation

@ddorian

@ddorian ddorian commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

fix for #517 regression test not replicating in macos. A demo where the test fails in all scenarios can be seen here: ddorian#1

The test only asked whether the class survived the collection, which a
build without the fix can also satisfy: if the attribute lookup happened
to take a strong _PyCStackRef instead of a deferred one, or any other
reference lingered, the class stays alive and the test passes. That is
why it kept passing on mac/3.15b3 while failing on manylinux/3.15b4.

Look for the suspended greenlet in gc.get_referrers() of the class
instead. That is the reference the fix creates, so a build without it
reports the masking reference and fails wherever the class survives for
some unrelated reason.
@ddorian ddorian changed the title Check that the suspended greenlet is what keeps the class alive Fixing regression test for #517 so it fails on macos too Jul 23, 2026
@jamadden
jamadden merged commit e5c5f4c into python-greenlet:master Jul 23, 2026
39 checks passed
@jamadden

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants