Bug #337702 - Fix config.load_best_module() to raise ImportError from
authorZac Medico <zmedico@gentoo.org>
Thu, 16 Sep 2010 22:25:23 +0000 (15:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 16 Sep 2010 22:31:45 +0000 (15:31 -0700)
the indentation block that caught it.

In python3, we get a "RuntimeError: No active exception to reraise"
exception if we try to call raise after completion of the indentation
block were the last exception was caught.

pym/portage/package/ebuild/config.py

index 7c1060f1287a0bbc09fa37045d4ce05ca79d2a16..aa8d3c0a16cbd08e27d21dc7693874befbf96759 100644 (file)
@@ -886,14 +886,14 @@ class config(object):
                try:
                        mod = load_mod(best_mod)
                except ImportError:
-                       if best_mod.startswith("cache."):
+                       if not best_mod.startswith("cache."):
+                               raise
+                       else:
                                best_mod = "portage." + best_mod
                                try:
                                        mod = load_mod(best_mod)
                                except ImportError:
-                                       pass
-               if mod is None:
-                       raise
+                                       raise
                return mod
 
        def lock(self):