gzip bug?

A.M. Kuchling amk at mira.erols.com
Tue Aug 10 03:18:34 CEST 1999


On Mon, 09 Aug 1999 21:55:46 GMT, 
	catlee at my-deja.com <catlee at my-deja.com> wrote:
>gzip file objects don't seem to close themselves automatically.  When I
>do this:

Because they don't have a __del__ method, so when you're writing the
output file isn't closed (and the checksum isn't written).  Try this
patch:

Index: gzip.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/gzip.py,v
retrieving revision 1.12
diff -C3 -r1.12 gzip.py
*** gzip.py	1999/04/12 14:34:16	1.12
--- gzip.py	1999/08/10 01:16:51
***************
*** 251,256 ****
--- 251,259 ----
              self.myfileobj.close()
              self.myfileobj = None
  
+     def __del__(self):
+         if self.myfileobj is not None: self.close()
+         
      def flush(self):
          self.fileobj.flush()
  

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
The quality of what is said inevitably influences the way in which it is said,
however inexperienced the writer.
    -- Robertson Davies, _A Voice from the Attic_




More information about the Python-list mailing list