diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2006-11-20 13:39:57 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2006-11-20 13:39:57 +0000 |
commit | bb4e6dcff51ea03a762f12a1e9c1fbdcfcdbbe38 (patch) | |
tree | bc8d9cd7bdaa34eb3516891b6b5d4fe3ef5f5a8e /Lib/uu.py | |
parent | 90e23c47692df172c512881d0a35a07db2a43cbf (diff) | |
download | cpython-git-bb4e6dcff51ea03a762f12a1e9c1fbdcfcdbbe38.tar.gz |
Jython compatibility fix: if uu.decode() opened its output file, be sure to
close it.
Diffstat (limited to 'Lib/uu.py')
-rwxr-xr-x | Lib/uu.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -114,6 +114,7 @@ def decode(in_file, out_file=None, mode=None, quiet=0): # # Open the output file # + opened = False if out_file == '-': out_file = sys.stdout elif isinstance(out_file, basestring): @@ -123,6 +124,7 @@ def decode(in_file, out_file=None, mode=None, quiet=0): except AttributeError: pass out_file = fp + opened = True # # Main decoding loop # @@ -140,6 +142,8 @@ def decode(in_file, out_file=None, mode=None, quiet=0): s = in_file.readline() if not s: raise Error('Truncated input file') + if opened: + out_file.close() def test(): """uuencode/uudecode main program""" |