From 9196da417d20e1484e23b3c80483b0222abaadf2 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 9 May 2023 13:33:36 +0100 Subject: gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320) --- Lib/test/libregrtest/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index fb13fa0..fd46819 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. -- cgit v0.12