summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2009-10-29 09:15:00 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2009-10-29 09:15:00 (GMT)
commit8c06ccc058e1fb5d120da8e0b8ce5fc3a5abb6b6 (patch)
treee720d87324847ad540b23e9dfb237df89ad2ffef
parentea0e3b0d60b075e6d5cb09dcd83fd86e828612cb (diff)
downloadcpython-8c06ccc058e1fb5d120da8e0b8ce5fc3a5abb6b6.zip
cpython-8c06ccc058e1fb5d120da8e0b8ce5fc3a5abb6b6.tar.gz
cpython-8c06ccc058e1fb5d120da8e0b8ce5fc3a5abb6b6.tar.bz2
Issue #4750: Store the basename of the original filename in
the gzip FNAME header as required by RFC 1952.
-rw-r--r--Lib/gzip.py4
-rw-r--r--Misc/NEWS3
2 files changed, 5 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 9605d5d..8d71cd3 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -5,7 +5,7 @@ but random access is not allowed."""
# 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 @@ class GzipFile:
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
diff --git a/Misc/NEWS b/Misc/NEWS
index 24cb7b3..2e2f822 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -427,6 +427,9 @@ Core and Builtins
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.