Skip to content

Commit

Permalink
pythongh-116731: libregrtest: Clear inspect & importlib.metadata cach…
Browse files Browse the repository at this point in the history
…es in clear_caches (pythonGH-116805)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
2 people authored and vstinner committed Mar 20, 2024
1 parent ae432c8 commit 31553e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/test/libregrtest/utils.py
Expand Up @@ -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():
Expand Down

0 comments on commit 31553e0

Please sign in to comment.