diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 21:15:17 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 21:15:17 +0000 |
commit | c11682af1490a2dbcba37d5a8e9d20ea32154280 (patch) | |
tree | 23c2c67438883dca58f4107d509b2b77acd7bb56 /Lib/base64.py | |
parent | 129e8ae8cb8bcdcf2bf7d11d0a0ef050aebd1bd3 (diff) | |
download | cpython-c11682af1490a2dbcba37d5a8e9d20ea32154280.tar.gz |
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 faa3836e60..af7cf64465 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) |