[Python-checkins] r69835 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py

brett.cannon python-checkins at python.org
Sat Feb 21 04:53:06 CET 2009


Author: brett.cannon
Date: Sat Feb 21 04:53:06 2009
New Revision: 69835

Log:
Tweak the source/bytecode loader from importlib to use more of the PEP 302
protocol API.


Modified:
   python/branches/py3k/Lib/importlib/NOTES
   python/branches/py3k/Lib/importlib/_bootstrap.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:53:06 2009
@@ -7,6 +7,7 @@
 
     + PyLoader (for ABC)
 
+        - load_module for source only
         - get_code for source only
 
     + PyFileLoader(PyLoader)
@@ -17,6 +18,7 @@
 
     +PyPycLoader (PyLoader, for ABC)
 
+        - load_module for source and bytecode
         - get_code for source and bytecode
         
     + PyPycFileLoader(PyPycLoader, PyFileLoader)

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:53:06 2009
@@ -361,7 +361,6 @@
         # Not a property for easy overriding.
         return self._find_path(imp.PY_COMPILED)
 
-    @check_name
     @module_for_loader
     def load_module(self, module):
         """Load a Python source or bytecode module."""
@@ -371,7 +370,7 @@
         code_object = self.get_code(module.__name__)
         module.__file__ = source_path if source_path else bytecode_path
         module.__loader__ = self
-        if self._is_pkg:
+        if self.is_package(name):
             module.__path__  = [module.__file__.rsplit(path_sep, 1)[0]]
         module.__package__ = module.__name__
         if not hasattr(module, '__path__'):
@@ -429,7 +428,6 @@
             else:
                 raise
 
-    @check_name
     def get_code(self, name):
         """Return the code object for the module."""
         # XXX Care enough to make sure this call does not happen if the magic


More information about the Python-checkins mailing list