[issue44895] refleak test failure in test_exceptions

STINNER Victor report at bugs.python.org
Wed Sep 1 11:06:03 EDT 2021


STINNER Victor <vstinner at python.org> added the comment:

>  I changed dash_R_cleanup to put the sys._clear_type_cache() after clear_caches() and the leak is gone

Aha! The order of function calls in dash_R_cleanup() matters.

Calling sys._clear_type_cache() at the end of dash_R_cleanup() perfectly makes sense. If you do that, please add a comment to explain that the order matters. For example, the code about ABC classes is likely to modify classes.

About the gc_collect() call, I dislike calling it in clear_caches() and then again in dash_R_cleanup(). I would even prefer to *remove* it from both functions and call it explicitly at the call site: in dash_R() and in runtest.py.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44895>
_______________________________________


More information about the Python-bugs-list mailing list