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.