Skip to content
Browse files

Improve compatibility with standard Python imports (if it raises an e…

…xceptions).
  • Loading branch information...
1 parent 7bd6301 commit f438253616166733f68a08123618dc85aecc71b8 @rasky rasky committed Nov 27, 2007
Showing with 6 additions and 0 deletions.
  1. +3 −0 doc/CHANGES.txt
  2. +3 −0 iu.py
View
3 doc/CHANGES.txt
@@ -25,6 +25,9 @@ Changes since PyInstaller 1.3
same third-party library (like e.g. wxPython allows to do).
+ Fix a stupid bug with modules importing optparse (under Linux) (thanks
to Louai Al-Khanji).
+ + Under Python 2.4+, if an exception is raised while importing a module
+ inside a package, the module is now removed from the parent's
+ namespace (to match the behaviour of Python itself).
PyInstaller 1.3
---------------
View
3 iu.py
@@ -379,6 +379,7 @@ def doimport(self, nm, parentnm, fqname, reload=0):
#print "..parent not a package"
return None
else:
+ parent = None
# now we're dealing with an absolute import
for director in self.metapath:
mod = director.getmod(nm)
@@ -408,6 +409,8 @@ def doimport(self, nm, parentnm, fqname, reload=0):
# of failure?
if not reload:
del sys.modules[fqname]
+ if hasattr(parent, nm):
+ delattr(parent, nm)
raise
if fqname == 'thread' and not self.threaded:
## print "thread detected!"

0 comments on commit f438253

Please sign in to comment.
Something went wrong with that request. Please try again.