summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-11-20 13:39:37 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-11-20 13:39:37 (GMT)
commit5dba6f74c60391d2933830f82f3fa8ee0a5d241c (patch)
treee933b3b07308d6631e83a4c4a02b905a96137357 /Lib
parent1e753863b3b44aef56c039b8b07f8c73b17c669e (diff)
downloadcpython-5dba6f74c60391d2933830f82f3fa8ee0a5d241c.zip
cpython-5dba6f74c60391d2933830f82f3fa8ee0a5d241c.tar.gz
cpython-5dba6f74c60391d2933830f82f3fa8ee0a5d241c.tar.bz2
Jython compatibility fix: if uu.decode() opened its output file, be sure to
close it.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/uu.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/uu.py b/Lib/uu.py
index 3ccedb0..da89f72 100755
--- a/Lib/uu.py
+++ b/Lib/uu.py
@@ -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"""