summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2024-03-14 15:47:12 (GMT)
committerGitHub <noreply@github.com>2024-03-14 15:47:12 (GMT)
commitbae6579b46df50dee4dbb77ea242270d27cd0c9d (patch)
tree093d7e679b489b35b4e52f27c0c4a874724d793a /Lib
parent846ad5a26ac0ff988a3fceec8f8e830f68bdf48a (diff)
downloadcpython-bae6579b46df50dee4dbb77ea242270d27cd0c9d.zip
cpython-bae6579b46df50dee4dbb77ea242270d27cd0c9d.tar.gz
cpython-bae6579b46df50dee4dbb77ea242270d27cd0c9d.tar.bz2
gh-116731: libregrtest: Clear inspect & importlib.metadata caches in clear_caches (GH-116805)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/libregrtest/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 7765ae8..837f73b 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -276,6 +276,15 @@ def clear_caches():
pass
else:
inspect._shadowed_dict_from_mro_tuple.cache_clear()
+ inspect._filesbymodname.clear()
+ inspect.modulesbyfile.clear()
+
+ try:
+ importlib_metadata = sys.modules['importlib.metadata']
+ except KeyError:
+ pass
+ else:
+ importlib_metadata.FastPath.__new__.cache_clear()
def get_build_info():