Skip to content

Conversation

@nascheme
Copy link
Member

@nascheme nascheme commented Jun 30, 2025

This is an attempt at making a fix that could be backported to old Python versions. In main, I think the best fix is to stop clearing all weakrefs in the GC. However, that seems disruptive enough that we should avoid doing so in a bugfix release. This version of the fix doesn't clear if wr_object is a type and wr_callback == NULL. There is still a small chance this would break some code that expects that weakrefs are cleared by the GC. In the unit test suite, we had test_finalization, test_io and test_gc that was broken by not clearing weakrefs.

@nascheme
Copy link
Member Author

nascheme commented Jul 1, 2025

I don't think this is safe actually, could introduce bugs like bpo-38006.

@nascheme nascheme closed this Jul 1, 2025
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.

1 participant