[Python-checkins] r75935 - in python/trunk: Lib/gzip.py Misc/NEWS

lars.gustaebel python-checkins at python.org
Thu Oct 29 10:15:00 CET 2009


Author: lars.gustaebel
Date: Thu Oct 29 10:15:00 2009
New Revision: 75935

Log:
Issue #4750: Store the basename of the original filename in
the gzip FNAME header as required by RFC 1952.


Modified:
   python/trunk/Lib/gzip.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/gzip.py
==============================================================================
--- python/trunk/Lib/gzip.py	(original)
+++ python/trunk/Lib/gzip.py	Thu Oct 29 10:15:00 2009
@@ -5,7 +5,7 @@
 
 # based on Andrew Kuchling's minigzip.py distributed with the zlib module
 
-import struct, sys, time
+import struct, sys, time, os
 import zlib
 import __builtin__
 
@@ -143,7 +143,7 @@
     def _write_gzip_header(self):
         self.fileobj.write('\037\213')             # magic header
         self.fileobj.write('\010')                 # compression method
-        fname = self.name
+        fname = os.path.basename(self.name)
         if fname.endswith(".gz"):
             fname = fname[:-3]
         flags = 0

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu Oct 29 10:15:00 2009
@@ -427,6 +427,9 @@
 Library
 -------
 
+- Issue #4750: Store the basename of the original filename in the gzip FNAME
+  header as required by RFC 1952.
+
 - Issue #1180: Added a new global option to ignore ~/.pydistutils.cfg in
   Distutils.
 


More information about the Python-checkins mailing list