diff options
Diffstat (limited to 'Lib/ihooks.py')
-rw-r--r-- | Lib/ihooks.py | 8 |
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 |