diff Lib/importlib/_bootstrap.py @ 76826:d6324941b739

Issue #14583: Fix importlib bug when a package's __init__.py would first import one of its modules then raise an error.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 07 May 2012 21:41:59 +0200
parents 146001e3364d
children b81ddaf0db47
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py	Mon May 07 17:25:14 2012 +0100
+++ b/Lib/importlib/_bootstrap.py	Mon May 07 21:41:59 2012 +0200
@@ -1082,7 +1082,7 @@
         # Return up to the first dot in 'name'. This is complicated by the fact
         # that 'name' may be relative.
         if level == 0:
-            return sys.modules[name.partition('.')[0]]
+            return _gcd_import(name.partition('.')[0])
         elif not name:
             return module
         else: