Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix Python 3.2 test failures (ResourceWarnings from unclosed files).

Closes gh-2083.
  • Loading branch information...
commit b1a8e9db1f79b2bca93799cd7644813b7f4a4221 1 parent 70ea9a8
@bfroehle bfroehle authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  IPython/utils/py3compat.py
View
3  IPython/utils/py3compat.py
@@ -73,7 +73,8 @@ def isidentifier(s, dotted=False):
def execfile(fname, glob, loc=None):
loc = loc if (loc is not None) else glob
- exec compile(open(fname, 'rb').read(), fname, 'exec') in glob, loc
+ with open(fname, 'rb') as f:
+ exec compile(f.read(), fname, 'exec') in glob, loc
# Refactor print statements in doctests.
_print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE)
Please sign in to comment.
Something went wrong with that request. Please try again.