From b5cec0fc09e7ac5b5f3540f5f3f121d0a2b3281b Mon Sep 17 00:00:00 2001 From: giovannibajo Date: Wed, 31 Mar 2010 22:08:12 +0000 Subject: [PATCH] Avoid raising an exception within an except clause that will re-raise git-svn-id: http://svn.pyinstaller.org/trunk@816 8dd32b29-ccff-0310-8a9a-9233e24343b1 --- iu.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/iu.py b/iu.py index 2bc8f3c..87b9584 100644 --- a/iu.py +++ b/iu.py @@ -528,13 +528,10 @@ class ImportManager: # Should we save the mod dict and restore it in case # of failure? if not reload: - try: - del sys.modules[fqname] - except KeyError: - # Some modules (eg: dbhash.py) cleanup - # sys.modules themselves. We should then - # be lenient and avoid errors. - pass + # Some modules (eg: dbhash.py) cleanup + # sys.modules themselves. We should then + # be lenient and avoid errors. + sys.modules.pop(fqname, None) if hasattr(parent, nm): delattr(parent, nm) raise