diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-21 03:31:35 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-21 03:31:35 (GMT) |
commit | 4afab6b30b6262012946171fbcb69043c4b28efc (patch) | |
tree | 41b93494c5c79a251a12c30eabefa5cc8e0a33e8 /Lib/importlib/_bootstrap.py | |
parent | 2dee597e0593a8f7b477f58afe5e46f94b994541 (diff) | |
download | cpython-4afab6b30b6262012946171fbcb69043c4b28efc.zip cpython-4afab6b30b6262012946171fbcb69043c4b28efc.tar.gz cpython-4afab6b30b6262012946171fbcb69043c4b28efc.tar.bz2 |
Separate out finder for source and source/bytecode.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 4db61da..068ee10 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): |