mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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.
This commit is contained in:
parent
51fa3b740f
commit
3d3cfdb499
2 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue