ihooks FancyModuleLoader.load_module()
imputils Importer._process_result():
remove name from modules dict if exec fails.
This is what all the builtin importers do now, new in 2.4.
diff --git a/Lib/ihooks.py b/Lib/ihooks.py
index 936a950..f5b93ab 100644
--- a/Lib/ihooks.py
+++ b/Lib/ihooks.py
@@ -322,7 +322,13 @@
if path:
m.__path__ = path
m.__file__ = filename
- exec code in m.__dict__
+ try:
+ exec code in m.__dict__
+ except:
+ d = self.hooks.modules_dict()
+ if name in d:
+ del d[name]
+ raise
return m