diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-08-01 22:05:41 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-08-01 22:05:41 (GMT) |
commit | a90f311d0592f6ab56068441413a1925bd7393f4 (patch) | |
tree | 96934bca2056b743f2f3192d067416f512ced0fd /Tools/scripts/pysource.py | |
parent | 98516a6930acdd39f74c609817cbf19be6c4a7df (diff) | |
download | cpython-a90f311d0592f6ab56068441413a1925bd7393f4.zip cpython-a90f311d0592f6ab56068441413a1925bd7393f4.tar.gz cpython-a90f311d0592f6ab56068441413a1925bd7393f4.tar.bz2 |
Cleanup findnocoding.py and pysource.py scripts (with infile/infile.close)
Diffstat (limited to 'Tools/scripts/pysource.py')
-rwxr-xr-x | Tools/scripts/pysource.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py index 7348a68..69e8e0d 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") |