From: Alex Waygood Date: Tue, 9 May 2023 12:33:36 +0000 (+0100) Subject: gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320) X-Git-Tag: v3.12.0b1~200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9196da417d20e1484e23b3c80483b0222abaadf2;p=thirdparty%2FPython%2Fcpython.git gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320) --- diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index fb13fa0e243b..fd46819fd903 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -210,6 +210,13 @@ def clear_caches(): else: fractions._hash_algorithm.cache_clear() + try: + inspect = sys.modules['inspect'] + except KeyError: + pass + else: + inspect._shadowed_dict_from_mro_tuple.cache_clear() + def get_build_info(): # Get most important configure and build options as a list of strings.