[Python-bugs-list] [ python-Bugs-417178 ] uu.py doesn't close in_file on exception

noreply@sourceforge.net noreply@sourceforge.net
Fri, 27 Apr 2001 23:04:26 -0700


Bugs item #417178, was updated on 2001-04-18 15:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=417178&group_id=5470

Category: Python Library
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Tim Peters (tim_one)
Summary: uu.py doesn't close in_file on exception

Initial Comment:
When decoding a uu-encoded file with uu.decode(), the 
given in_file is not closed before a uu.Error is 
raised.

This leads to problems on Win32 when trying to 
os.remove() the file after the exception was raised, 
because the permission to remove the file is denied.

Maybe the same problem is present for out_file.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-04-27 23:04

Message:
Logged In: YES 
user_id=31435

It's unclear whether you're passing a file object or a 
pathname to decode().

If you're passing a file object, it's never decode()'s job 
to close it (decode didn't open it, so it's got no business 
closing it either).

If you're passing a pathname, you're using a deprecated 
feature (see the docs), and deprecated features don't get 
enhanced (they only exist for backward compatibility).

So, sorry, but in either case this won't be changed.  As 
the dcos say, you should pass a file object, and then it's 
your responsibility to close the files you open.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=417178&group_id=5470