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#28005serhiy-storchaka merged 4 commits into
Conversation
653b762 to
deaa294
Compare
August 27, 2021 19:57
gpshead
left a comment
There was a problem hiding this comment.
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.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @gpshead: please review the changes made to this pull request. |
Sorry, something went wrong.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
Sorry, something went wrong.
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry, something went wrong.
|
Sorry @serhiy-storchaka, I had trouble checking out the |
Sorry, something went wrong.
…ythonGH-28005). (cherry picked from commit 2a8127c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ythonGH-28005). (cherry picked from commit 2a8127c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
https://bugs.python.org/issue25130