diff Lib/importlib/_bootstrap.py @ 52083:c06f02a5e962

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.
author Brett Cannon <bcannon@gmail.com>
date Mon, 09 Mar 2009 03:35:50 +0000
parents 65371df41aca
children 03080fa08dfe
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py	Mon Mar 09 02:02:23 2009 +0000
+++ b/Lib/importlib/_bootstrap.py	Mon Mar 09 03:35:50 2009 +0000
@@ -383,14 +383,8 @@
     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)