Author: Manuel Jacob
Branch:
Changeset: r71580:5752672ddec8
Date: 2014-05-19 04:39 +0200
http://bitbucket.org/pypy/pypy/changeset/5752672ddec8/
Log: Use with statement here instead of closing the file manually.
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -608,9 +608,8 @@
python_startup = readenv and os.getenv('PYTHONSTARTUP')
if python_startup:
try:
- f = open(python_startup)
- startup = f.read()
- f.close()
+ with open(python_startup) as f:
+ startup = f.read()
except IOError as e:
print >> sys.stderr, "Could not open PYTHONSTARTUP"
print >> sys.stderr, "IOError:", e
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit