[Python-checkins] cpython: Fix #12811 by closing files promptly in tabnanny.check. Patch by Anthony Briggs.

nick.coghlan python-checkins at python.org
Mon Aug 22 08:19:38 CEST 2011


http://hg.python.org/cpython/rev/c5cb0aa5bed6
changeset:   72032:c5cb0aa5bed6
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Mon Aug 22 16:19:19 2011 +1000
summary:
  Fix #12811 by closing files promptly in tabnanny.check. Patch by Anthony Briggs.

files:
  Lib/tabnanny.py |  3 +++
  Misc/ACKS       |  1 +
  Misc/NEWS       |  3 +++
  3 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
--- a/Lib/tabnanny.py
+++ b/Lib/tabnanny.py
@@ -126,6 +126,9 @@
             else: print(file, badline, repr(line))
         return
 
+    finally:
+        f.close()
+
     if verbose:
         print("%r: Clean bill of health." % (file,))
 
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -121,6 +121,7 @@
 Brian Brazil
 Dave Brennan
 Tom Bridgman
+Anthony Briggs
 Tobias Brink
 Richard Brodie
 Michael Broghton
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -265,6 +265,9 @@
 Library
 -------
 
+- Issue #12811: tabnanny.check() now promptly closes checked files. Patch by
+  Anthony Briggs.
+
 - Issue #6560: The sendmsg/recvmsg API is now exposed by the socket module
   when provided by the underlying platform, supporting processing of
   ancillary data in pure Python code.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list