diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 21:15:17 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 21:15:17 (GMT) |
commit | b86680e299d7429532518a496031cb96aa2ea659 (patch) | |
tree | c908511dfb569e7a640ed65cc412f1556f0ecc12 /Lib/base64.py | |
parent | d9f57630fed16bd1e97737f8afc22b5cc6645769 (diff) | |
download | cpython-b86680e299d7429532518a496031cb96aa2ea659.zip cpython-b86680e299d7429532518a496031cb96aa2ea659.tar.gz cpython-b86680e299d7429532518a496031cb96aa2ea659.tar.bz2 |
Explicitly close some files (from issue #10093)
Diffstat (limited to 'Lib/base64.py')
-rwxr-xr-x | Lib/base64.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/base64.py b/Lib/base64.py index faa3836..af7cf64 100755 --- a/Lib/base64.py +++ b/Lib/base64.py @@ -383,7 +383,8 @@ def main(): if o == '-u': func = decode if o == '-t': test(); return if args and args[0] != '-': - func(open(args[0], 'rb'), sys.stdout.buffer) + with open(args[0], 'rb') as f: + func(f, sys.stdout.buffer) else: func(sys.stdin.buffer, sys.stdout.buffer) |