summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py12
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):