New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-25130: Add calls of gc.collect() in tests to support PyPy #28005
bpo-25130: Add calls of gc.collect() in tests to support PyPy #28005
Conversation
653b762
to
deaa294
Compare
TL;DR - We should include comments on all of these stating why they exist and how to know when they're still relevant.
Calling gc.collect(), even multiple times, from any code, test or not, is usually a sign of fragility and something that isn't being done right. It can't guarantee any particular direct action.
When they don't make a difference in CPython if someone removes them, we can expect these to disappear from the codebase over time during maintenance.
If we want these, we should include a comment on all of them stating why it is here and how to determine if each is still relevant or not. Otherwise they become mysterious lore in the code and get copied around, deleted, changed, for no rhyme of reason over time.
When you're done making the requested changes, leave the comment: |
What comments should I add? In most cases the pattern is the same:
It is all either to check that there are no other references to obj, or to trigger it's |
Even just an end of line comment on the added calls such as
So long as there's some indication of why the call is there given that today's CPython refcounting gc didn't need it. |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @gpshead: please review the changes made to this pull request. |
Thanks @serhiy-storchaka for the PR |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry @serhiy-storchaka, I had trouble checking out the |
…ythonGH-28005). (cherry picked from commit 2a8127c) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-28027 is a backport of this pull request to the 3.10 branch. |
…ythonGH-28005). (cherry picked from commit 2a8127c) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-28028 is a backport of this pull request to the 3.9 branch. |
…H-28005) (GH-28027) (cherry picked from commit 2a8127c) Co-authored-by: Serhiy Storchaka <[email protected]>
https://bugs.python.org/issue25130