Skip to content

Commit

Permalink
Fix crash from deleting undefined variables (#170)
Browse files Browse the repository at this point in the history
This address a bug introduced in 3.2 that occurs when running a Circuits
app with packaged with py2exe into a single zip file. In that case, the
innermost if-check would never pass, the fd and exec_ variables would never be
defined, and the final del would raise an unhandled NameError.
  • Loading branch information
AdricEpic authored and prologic committed Jul 23, 2016
1 parent e276b3e commit c9b9eb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion circuits/__init__.py
Expand Up @@ -31,10 +31,11 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
import os
from .six import exec_
fd = None
for _path in __path__:
_path = os.path.join(_path, '__init__.py')
if _path != __file__ and os.path.exists(_path):
from .six import exec_
with open(_path) as fd:
exec_(fd, globals())
del os, extend_path, _path, fd, exec_
Expand Down

0 comments on commit c9b9eb0

Please sign in to comment.