[Python-bugs-list] [ python-Bugs-486480 ] zipfile __del__ is broken

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Nov 2001 15:17:26 -0800


Bugs item #486480, was opened at 2001-11-28 06:45
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486480&group_id=5470

Category: Python Library
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Itamar Shtull-Trauring (itamar)
>Assigned to: Tim Peters (tim_one)
Summary: zipfile __del__ is broken

Initial Comment:
The __del__ method calls self.fp.close(), instead of
calling self.close(). As a result, if you opened a
zipfile in write mode and forgot to close() it, it will
*not* be closed correctly when __del__ is called.

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

>Comment By: Tim Peters (tim_one)
Date: 2001-11-28 15:17

Message:
Logged In: YES 
user_id=31435

Fixed, in

Lib/zipfile.py; new revision: 1.19

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

Comment By: Jeremy Hylton (jhylton)
Date: 2001-11-28 07:53

Message:
Logged In: YES 
user_id=31392

I guess it's a bug since __del__() doesn't do what the doc
string says, but shouldn't the program be calling close()
explicitly.  It makes some (a little) sense to think of
__del__() only as a stop-gap measure to prevent a program
from leaking file descriptors.


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

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