Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ sysconfig
which has been deprecated since Python 3.14.
Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.

tarfile
-------

* The undocumented and unused :attr:`!tarfile.TarFile.tarfile` attribute
has been deprecated since Python 3.13.

.. Add removals above alphabetically, not here at the end.


Expand Down
20 changes: 0 additions & 20 deletions Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@ class TarInfo(object):
pax_headers = ('A dictionary containing key-value pairs of an '
'associated pax extended header.'),
sparse = 'Sparse member information.',
_tarfile = None,
_sparse_structs = None,
_link_target = None,
)
Expand Down Expand Up @@ -942,24 +941,6 @@ def __init__(self, name=""):
self.sparse = None # sparse member information
self.pax_headers = {} # pax header information

@property
def tarfile(self):
import warnings
warnings.warn(
'The undocumented "tarfile" attribute of TarInfo objects '
+ 'is deprecated and will be removed in Python 3.16',
DeprecationWarning, stacklevel=2)
return self._tarfile

@tarfile.setter
def tarfile(self, tarfile):
import warnings
warnings.warn(
'The undocumented "tarfile" attribute of TarInfo objects '
+ 'is deprecated and will be removed in Python 3.16',
DeprecationWarning, stacklevel=2)
self._tarfile = tarfile

@property
def path(self):
'In pax headers, "name" is called "path".'
Expand Down Expand Up @@ -2196,7 +2177,6 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
# Now, fill the TarInfo object with
# information specific for the file.
tarinfo = self.tarinfo()
tarinfo._tarfile = self # To be removed in 3.16.

# Use os.stat or os.lstat, depending on if symlinks shall be resolved.
if fileobj is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated and unused :attr:`!tarfile.Tarfile.tarfile` attribute.
Loading