[Python-checkins] r52791 - python/branches/release22-maint/Lib/uu.py

andrew.kuchling python-checkins at python.org
Sun Nov 19 20:00:04 CET 2006


Author: andrew.kuchling
Date: Sun Nov 19 20:00:04 2006
New Revision: 52791
Modified:
 python/branches/release22-maint/Lib/uu.py
Log:
Jython compatibility fix: if uu.decode() opened its output file, be sure to close it. (Need to forward-port this.)
Modified: python/branches/release22-maint/Lib/uu.py
==============================================================================
--- python/branches/release22-maint/Lib/uu.py	(original)
+++ python/branches/release22-maint/Lib/uu.py	Sun Nov 19 20:00:04 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

AltStyle によって変換されたページ (->オリジナル) /