diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2006-11-19 19:00:04 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2006-11-19 19:00:04 +0000 |
commit | 64b8431b56aeb372807f9650c1e7a6d24c1a7525 (patch) | |
tree | 3641207d1ced84586fa0449f0c82ace555f56599 | |
parent | d918437126c0fbda82d0bc9c7d24a57e28da79a6 (diff) | |
download | cpython-64b8431b56aeb372807f9650c1e7a6d24c1a7525.tar.gz |
Jython compatibility fix: if uu.decode() opened its output file, be sure to close it. (Need to forward-port this.)
-rwxr-xr-x | Lib/uu.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -115,6 +115,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, StringType): @@ -124,6 +125,7 @@ def decode(in_file, out_file=None, mode=None, quiet=0): except AttributeError: pass out_file = fp + opened = True # # Main decoding loop # @@ -141,6 +143,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""" |