Index: Lib/uu.py =================================================================== --- Lib/uu.py (revision 85974) +++ Lib/uu.py (working copy) @@ -44,6 +44,7 @@ # # If in_file is a pathname open it and change defaults # + opened_files = [] if in_file == '-': in_file = sys.stdin.buffer elif isinstance(in_file, str): @@ -55,6 +56,7 @@ except AttributeError: pass in_file = open(in_file, 'rb') + opened_files.append(in_file) # # Open out_file if it is a pathname # @@ -62,6 +64,7 @@ out_file = sys.stdout.buffer elif isinstance(out_file, str): out_file = open(out_file, 'wb') + opened_files.append(out_file) # # Set defaults for name and mode # @@ -78,6 +81,8 @@ out_file.write(binascii.b2a_uu(data)) data = in_file.read(45) out_file.write(b' \nend\n') + for f in opened_files: + f.close() def decode(in_file, out_file=None, mode=None, quiet=False):