[Python-checkins] r75937 - in python/branches/py3k: Lib/gzip.py Misc/NEWS

lars.gustaebel python-checkins at python.org
Thu Oct 29 10:39:48 CET 2009


Author: lars.gustaebel
Date: Thu Oct 29 10:39:47 2009
New Revision: 75937

Log:
Merged revisions 75935 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75935 | lars.gustaebel | 2009-10-29 10:15:00 +0100 (Thu, 29 Oct 2009) | 3 lines
  
  Issue #4750: Store the basename of the original filename in
  the gzip FNAME header as required by RFC 1952.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/gzip.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/gzip.py
==============================================================================
--- python/branches/py3k/Lib/gzip.py	(original)
+++ python/branches/py3k/Lib/gzip.py	Thu Oct 29 10:39:47 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 builtins
 
@@ -158,7 +158,8 @@
         try:
             # RFC 1952 requires the FNAME field to be Latin-1. Do not
             # include filenames that cannot be represented that way.
-            fname = self.name.encode('latin-1')
+            fname = os.path.basename(self.name)
+            fname = fname.encode('latin-1')
             if fname.endswith(b'.gz'):
                 fname = fname[:-3]
         except UnicodeEncodeError:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Oct 29 10:39:47 2009
@@ -120,6 +120,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