mirror of https://github.com/python/cpython
gh-116811: Ensure MetadataPathFinder.invalidate_caches is reachable when delegated through PathFinder. (#116812)
* Make MetadataPathFinder a proper classmethod. * In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches. * Add blurb
This commit is contained in:
parent
be59aaf3ab
commit
5f52d20a93
|
@ -1470,6 +1470,9 @@ class PathFinder:
|
|||
# https://bugs.python.org/issue45703
|
||||
_NamespacePath._epoch += 1
|
||||
|
||||
from importlib.metadata import MetadataPathFinder
|
||||
MetadataPathFinder.invalidate_caches()
|
||||
|
||||
@staticmethod
|
||||
def _path_hooks(path):
|
||||
"""Search sys.path_hooks for a finder for 'path'."""
|
||||
|
|
|
@ -797,6 +797,7 @@ class MetadataPathFinder(DistributionFinder):
|
|||
path.search(prepared) for path in map(FastPath, paths)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def invalidate_caches(cls) -> None:
|
||||
FastPath.__new__.cache_clear()
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
In ``PathFinder.invalidate_caches``, delegate to
|
||||
``MetadataPathFinder.invalidate_caches``.
|
Loading…
Reference in New Issue