Skip to content

Commit

Permalink
[3.12] gh-116731: libregrtest: Clear inspect & importlib.metadata cac…
Browse files Browse the repository at this point in the history
…hes in clear_caches (GH-116805) (GH-116820)

gh-116731: libregrtest: Clear inspect & importlib.metadata caches in clear_caches (GH-116805)
(cherry picked from commit bae6579)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
3 people committed Mar 14, 2024
1 parent 56a3c5f commit 9d08e14
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 9d08e14

Please sign in to comment.