bpo-25130: Add calls of gc.collect() in tests to support PyPy by serhiy-storchaka · Pull Request #28005 · python/cpython (original) (raw)

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.