gh-149634: Remove deprecated and unused tarfile.Tarfile.tarfile attr (GH-149635)

This commit is contained in:
sobolevn 2026-05-11 13:54:49 +03:00 committed by GitHub
parent 53c3dd9a8d
commit 0108843451
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 20 deletions

View file

@ -140,6 +140,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.

View file

@ -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,
)
@ -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".'
@ -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:

View file

@ -0,0 +1 @@
Remove deprecated and unused :attr:`!tarfile.Tarfile.tarfile` attribute.