From c4a287114e2377772643e354fff5c388899cabff Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Mon, 22 Aug 2011 16:19:19 +1000 Subject: [PATCH] Fix #12811 by closing files promptly in tabnanny.check. Patch by Anthony Briggs. --- Lib/tabnanny.py | 3 +++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py index 46f8163e5f7..4a54f89e82f 100755 --- a/Lib/tabnanny.py +++ b/Lib/tabnanny.py @@ -126,6 +126,9 @@ def check(file): 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 index 2b6104fe656..062a77ae9af 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -121,6 +121,7 @@ Erik Bray Brian Brazil Dave Brennan Tom Bridgman +Anthony Briggs Tobias Brink Richard Brodie Michael Broghton diff --git a/Misc/NEWS b/Misc/NEWS index ab70dfd8679..eeb0d71572e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -265,6 +265,9 @@ Core and Builtins 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.