[Python-checkins] cpython (merge 3.2 -> default): Merge #12295 fix from 3.2
eric.araujo
python-checkins at python.org
Mon Aug 1 17:31:48 CEST 2011
http://hg.python.org/cpython/rev/7af576e3cb0c
changeset: 71678:7af576e3cb0c
parent: 71676:4813fe208e29
parent: 71677:63bd8f42b511
user: Éric Araujo <merwok at netwok.org>
date: Mon Aug 01 17:31:12 2011 +0200
summary:
Merge #12295 fix from 3.2
files:
Lib/idlelib/textView.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py
--- a/Lib/idlelib/textView.py
+++ b/Lib/idlelib/textView.py
@@ -62,14 +62,15 @@
def view_file(parent, title, filename, encoding=None):
try:
- textFile = open(filename, 'r', encoding=encoding)
+ with open(filename, 'r', encoding=encoding) as file:
+ contents = file.read()
except IOError:
import tkinter.messagebox as tkMessageBox
tkMessageBox.showerror(title='File Load Error',
message='Unable to load file %r .' % filename,
parent=parent)
else:
- return view_text(parent, title, textFile.read())
+ return view_text(parent, title, contents)
if __name__ == '__main__':
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list