[Python-checkins] r69834 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py test/source/test_case_sensitivity.py test/source/test_finder.py

brett.cannon python-checkins at python.org
Sat Feb 21 04:31:35 CET 2009


Author: brett.cannon
Date: Sat Feb 21 04:31:35 2009
New Revision: 69834
Log:
Separate out finder for source and source/bytecode.
Modified:
 python/branches/py3k/Lib/importlib/NOTES
 python/branches/py3k/Lib/importlib/_bootstrap.py
 python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py
 python/branches/py3k/Lib/importlib/test/source/test_finder.py
Modified: python/branches/py3k/Lib/importlib/NOTES
==============================================================================
--- python/branches/py3k/Lib/importlib/NOTES	(original)
+++ python/branches/py3k/Lib/importlib/NOTES	Sat Feb 21 04:31:35 2009
@@ -5,19 +5,22 @@
 subclass of source support (makes it nicer for VMs that don't use CPython
 bytecode).
 
- + ExtensionFileFinder
- + PyFileFinder
- + PyPycFileFinder
- + PyFileLoader
+ + PyLoader (for ABC)
 
 - get_code for source only
+
+ + PyFileLoader(PyLoader)
+
 - get_data
 - source_mtime
 - source_path
 
- + PyPycFileLoader(PyFileLoader)
+ +PyPycLoader (PyLoader, for ABC)
+
+ - get_code for source and bytecode
+ 
+ + PyPycFileLoader(PyPycLoader, PyFileLoader)
 
- - get_code
 - bytecode_path
 - write_bytecode
 
Modified: python/branches/py3k/Lib/importlib/_bootstrap.py
==============================================================================
--- python/branches/py3k/Lib/importlib/_bootstrap.py	(original)
+++ python/branches/py3k/Lib/importlib/_bootstrap.py	Sat Feb 21 04:31:35 2009
@@ -592,10 +592,18 @@
 # 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 @@
 return None
 
 
-_DEFAULT_PATH_HOOK = chained_path_hook(ExtensionFileFinder, PyFileFinder)
+_DEFAULT_PATH_HOOK = chained_path_hook(ExtensionFileFinder, PyPycFileFinder)
 
 class _DefaultPathFinder(PathFinder):
 
Modified: python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py	(original)
+++ python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py	Sat Feb 21 04:31:35 2009
@@ -19,7 +19,7 @@
 assert name != name.lower()
 
 def find(self, path):
- finder = importlib.PyFileFinder(path)
+ finder = importlib.PyPycFileFinder(path)
 return finder.find_module(self.name)
 
 def sensitivity_test(self):
Modified: python/branches/py3k/Lib/importlib/test/source/test_finder.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/source/test_finder.py	(original)
+++ python/branches/py3k/Lib/importlib/test/source/test_finder.py	Sat Feb 21 04:31:35 2009
@@ -32,7 +32,7 @@
 """
 
 def import_(self, root, module):
- finder = importlib.PyFileFinder(root)
+ finder = importlib.PyPycFileFinder(root)
 return finder.find_module(module)
 
 def run_test(self, test, create=None, *, compile_=None, unlink=None):


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /