From 4afab6b30b6262012946171fbcb69043c4b28efc Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 21 Feb 2009 03:31:35 +0000 Subject: Separate out finder for source and source/bytecode. --- Lib/importlib/_bootstrap.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Lib/importlib/_bootstrap.py') diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 4db61da079..068ee1021c 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -592,10 +592,18 @@ class PyFileFinder(FileFinder): # Make sure that Python source files are listed first! Needed for an # optimization by the loader. self._suffixes = suffix_list(imp.PY_SOURCE) - self._suffixes += suffix_list(imp.PY_COMPILED) super().__init__(path_entry) +class PyPycFileFinder(PyFileFinder): + + """Finder for source and bytecode files.""" + + def __init__(self, path_entry): + super().__init__(path_entry) + self._suffixes += suffix_list(imp.PY_COMPILED) + + class PathFinder: """Meta path finder for sys.(path|path_hooks|path_importer_cache).""" @@ -659,7 +667,7 @@ class PathFinder: return None -_DEFAULT_PATH_HOOK = chained_path_hook(ExtensionFileFinder, PyFileFinder) +_DEFAULT_PATH_HOOK = chained_path_hook(ExtensionFileFinder, PyPycFileFinder) class _DefaultPathFinder(PathFinder): -- cgit v1.2.1