diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-03-09 03:35:50 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-03-09 03:35:50 (GMT) |
commit | 2a922ed6adf28fabd10cb852133be5aeeb906aa5 (patch) | |
tree | 233b1352e48970174dade4ca795d853b8cc6e501 /Lib/importlib/_bootstrap.py | |
parent | aa1c8d88992d482f90268f2352fccb6e74d87279 (diff) | |
download | cpython-2a922ed6adf28fabd10cb852133be5aeeb906aa5.zip cpython-2a922ed6adf28fabd10cb852133be5aeeb906aa5.tar.gz cpython-2a922ed6adf28fabd10cb852133be5aeeb906aa5.tar.bz2 |
Introduce importlib.abc. The module contains various ABCs related to imports
(mostly stuff specified by PEP 302). There are two ABCs, PyLoader and
PyPycLoader, which help with implementing source and source/bytecode loaders by
implementing load_module in terms of other methods. This removes a lot of
gritty details loaders typically have to worry about.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index c294490..58b5a46 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -383,14 +383,8 @@ class PyPycLoader(PyLoader): def load_module(self, module): """Load a module from source or bytecode.""" name = module.__name__ - try: - source_path = self.source_path(name) - except ImportError: - source_path = None - try: - bytecode_path = self.bytecode_path(name) - except ImportError: - bytecode_path = None + source_path = self.source_path(name) + bytecode_path = self.bytecode_path(name) # get_code can worry about no viable paths existing. module.__file__ = source_path or bytecode_path return self._load_module(module) |