gh-129640: Add tests for reference cycle in gzip.GzipFile#130916
gh-129640: Add tests for reference cycle in gzip.GzipFile#130916Mr-Sunglasses wants to merge 13 commits intopython:mainfrom
gzip.GzipFile#130916Conversation
Misc/NEWS.d/next/Library/2025-03-06-20-25-54.gh-issue-129640.iub32dw1.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
There was a problem hiding this comment.
Thanks @ZeroIntensity for the suggestions, I've made the change 😄
hauntsaninja
left a comment
There was a problem hiding this comment.
Why is the weakref not sufficient?
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I think just timing / this issue was added before, PR added after, didn't see this issue when I was working on the other one. Could you check if the issue is resolved with current main and/or 3.12 branch? I think #130055 should have fixed it as well as what it was directly trying to address (bad destruction order) by adding a weakref. I do like the testing for number of GCd object test / think that would be good to add regardless |
Thanks @cmaloney the issue is fixed in the cc. @hauntsaninja TiA. |
|
#130055 is backported to 3.12 and 3.13 (#130670 and #130669), so should be in the next minor release of both. According to the 3.13 Release Schedule (https://peps.python.org/pep-0719/), 3.13.3 bugfix release which should contain it is expected 2025-04-08. |
gzip.GzipFilegzip.GzipFile
Mr-Sunglasses
left a comment
There was a problem hiding this comment.
@cmaloney @hauntsaninja as of our discussions, I changed this PR for the tests for reference cycle in gzip.GzipFile.
- Also I'm not sure if it needs any NEWS entry, please let me know it need one.
|
Requesting @hauntsaninja for a review. |
hauntsaninja
left a comment
There was a problem hiding this comment.
This test passes on the commit prior to #130055, so I'm not sure it's testing what we want it to test. len(gc.get_objects()) is quite coarse, where does the magic 10 number come from? Can we instead get a weakref to the _WriteBufferStream and confirm it gets collected?
Issue: #129640
Related to: #129726
gzip.GzipFilecreates reference cycle that requires a deep garbage collection cycle to cleanup. #129640