mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
Separate out finder for source and source/bytecode.
This commit is contained in:
parent
2dee597e05
commit
4afab6b30b
4 changed files with 21 additions and 10 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue