[Python-checkins] r65402 - in python/trunk: Doc/library/tarfile.rst Lib/tarfile.py Misc/NEWS
lars.gustaebel
python-checkins at python.org
Sat Aug 2 13:26:40 CEST 2008
Author: lars.gustaebel
Date: Sat Aug 2 13:26:39 2008
New Revision: 65402
Log:
Issue #3039: Fix TarFileCompat.writestr() which always raised an
AttributeError since __slots__ were added to zipfile.ZipInfo in
r46967 two years ago.
Add a warning about the removal of TarFileCompat in Python 3.0.
Modified:
python/trunk/Doc/library/tarfile.rst
python/trunk/Lib/tarfile.py
python/trunk/Misc/NEWS
Modified: python/trunk/Doc/library/tarfile.rst
==============================================================================
--- python/trunk/Doc/library/tarfile.rst (original)
+++ python/trunk/Doc/library/tarfile.rst Sat Aug 2 13:26:39 2008
@@ -140,6 +140,10 @@
Constant for a :mod:`gzip` compressed tar archive.
+ .. deprecated:: 2.6
+ The :class:`TarFileCompat` class has been deprecated for removal in Python 3.0.
+
+
.. exception:: TarError
Base class for all :mod:`tarfile` exceptions.
Modified: python/trunk/Lib/tarfile.py
==============================================================================
--- python/trunk/Lib/tarfile.py (original)
+++ python/trunk/Lib/tarfile.py Sat Aug 2 13:26:39 2008
@@ -2468,6 +2468,9 @@
ZipFile class.
"""
def __init__(self, file, mode="r", compression=TAR_PLAIN):
+ from warnings import warnpy3k
+ warnpy3k("the TarFileCompat class has been removed in Python 3.0",
+ stacklevel=2)
if compression == TAR_PLAIN:
self.tarfile = TarFile.taropen(file, mode)
elif compression == TAR_GZIPPED:
@@ -2501,10 +2504,10 @@
except ImportError:
from StringIO import StringIO
import calendar
- zinfo.name = zinfo.filename
- zinfo.size = zinfo.file_size
- zinfo.mtime = calendar.timegm(zinfo.date_time)
- self.tarfile.addfile(zinfo, StringIO(bytes))
+ tinfo = TarInfo(zinfo.filename)
+ tinfo.size = len(bytes)
+ tinfo.mtime = calendar.timegm(zinfo.date_time)
+ self.tarfile.addfile(tinfo, StringIO(bytes))
def close(self):
self.tarfile.close()
#class TarFileCompat
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sat Aug 2 13:26:39 2008
@@ -38,6 +38,9 @@
Library
-------
+- Issue #3039: Fix tarfile.TarFileCompat.writestr() which always
+ raised an AttributeError.
+
- Issue #2523: Fix quadratic behaviour when read()ing a binary file without
asking for a specific length.
More information about the Python-checkins
mailing list