diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-21 03:53:06 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-21 03:53:06 (GMT) |
commit | 0515619dbc0c11818fa15785e40491cf8d01042f (patch) | |
tree | aaffaa3d9d20f2bcf9d0d6ac9fdc3e53d9706694 /Lib/importlib | |
parent | 4afab6b30b6262012946171fbcb69043c4b28efc (diff) | |
download | cpython-0515619dbc0c11818fa15785e40491cf8d01042f.zip cpython-0515619dbc0c11818fa15785e40491cf8d01042f.tar.gz cpython-0515619dbc0c11818fa15785e40491cf8d01042f.tar.bz2 |
Tweak the source/bytecode loader from importlib to use more of the PEP 302
protocol API.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/NOTES | 2 | ||||
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Lib/importlib/NOTES b/Lib/importlib/NOTES index 1bbcb96..35c8fd3 100644 --- a/Lib/importlib/NOTES +++ b/Lib/importlib/NOTES @@ -7,6 +7,7 @@ to do + PyLoader (for ABC) + - load_module for source only - get_code for source only + PyFileLoader(PyLoader) @@ -17,6 +18,7 @@ to do +PyPycLoader (PyLoader, for ABC) + - load_module for source and bytecode - get_code for source and bytecode + PyPycFileLoader(PyPycLoader, PyFileLoader) diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 068ee10..97e3f54 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -361,7 +361,6 @@ class _PyFileLoader: # 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 @@ class _PyFileLoader: 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 @@ class _PyFileLoader: 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 |