From a90f311d0592f6ab56068441413a1925bd7393f4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 2 Aug 2012 00:05:41 +0200 Subject: Cleanup findnocoding.py and pysource.py scripts (with infile/infile.close) --- Tools/scripts/pysource.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Tools/scripts/pysource.py') diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py index 7348a68f21..69e8e0df4f 100755 --- a/Tools/scripts/pysource.py +++ b/Tools/scripts/pysource.py @@ -55,8 +55,8 @@ def looks_like_python(fullpath): if infile is None: return False - line = infile.readline() - infile.close() + with infile: + line = infile.readline() if binary_re.search(line): # file appears to be binary @@ -76,8 +76,8 @@ def can_be_compiled(fullpath): if infile is None: return False - code = infile.read() - infile.close() + with infile: + code = infile.read() try: compile(code, fullpath, "exec") -- cgit v1.2.1