Separate out finder for source and source/bytecode.

This commit is contained in:
Brett Cannon 2009-02-21 03:31:35 +00:00
parent 2dee597e05
commit 4afab6b30b
4 changed files with 21 additions and 10 deletions

View file

@ -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):