summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-05-09 13:33:36 +0100
committerGitHub <noreply@github.com>2023-05-09 18:03:36 +0530
commit9196da417d20e1484e23b3c80483b0222abaadf2 (patch)
tree866a8a6d7238bc5b09986753cce9fd6049c62f16
parent41aff464cef83d2655029ddd180a51110e8d7f8e (diff)
downloadcpython-git-9196da417d20e1484e23b3c80483b0222abaadf2.tar.gz
gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)
-rw-r--r--Lib/test/libregrtest/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index fb13fa0e24..fd46819fd9 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.