[Python-checkins] r52803 - python/branches/release23-maint/Lib/uu.py
andrew.kuchling
python-checkins at python.org
Mon Nov 20 14:40:36 CET 2006
Author: andrew.kuchling
Date: Mon Nov 20 14:40:36 2006
New Revision: 52803
Modified:
python/branches/release23-maint/Lib/uu.py
Log:
Jython compatibility fix: if uu.decode() opened its output file, be sure to
close it.
Modified: python/branches/release23-maint/Lib/uu.py
==============================================================================
--- python/branches/release23-maint/Lib/uu.py (original)
+++ python/branches/release23-maint/Lib/uu.py Mon Nov 20 14:40:36 2006
@@ -115,6 +115,7 @@
#
# Open the output file
#
+ opened = False
if out_file == '-':
out_file = sys.stdout
elif isinstance(out_file, StringType):
@@ -124,6 +125,7 @@
except AttributeError:
pass
out_file = fp
+ opened = True
#
# Main decoding loop
#
@@ -141,6 +143,8 @@
s = in_file.readline()
if not s:
raise Error, 'Truncated input file'
+ if opened:
+ out_file.close()
def test():
"""uuencode/uudecode main program"""
More information about the Python-checkins
mailing list