summaryrefslogtreecommitdiffstats
path: root/Lib/ihooks.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-04 02:29:12 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-04 02:29:12 (GMT)
commit3d3cfdb4994ed672436e3e16b66ac1b9349543db (patch)
treef19d6781141cc18952f27285aadb7b5355c54bb5 /Lib/ihooks.py
parent51fa3b740f3d76a26942904e151d366699b3eba9 (diff)
downloadcpython-3d3cfdb4994ed672436e3e16b66ac1b9349543db.zip
cpython-3d3cfdb4994ed672436e3e16b66ac1b9349543db.tar.gz
cpython-3d3cfdb4994ed672436e3e16b66ac1b9349543db.tar.bz2
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.
Diffstat (limited to 'Lib/ihooks.py')
-rw-r--r--Lib/ihooks.py8
1 files changed, 7 insertions, 1 deletions
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 @@ class FancyModuleLoader(ModuleLoader):
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