]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149634: Remove deprecated and unused `tarfile.Tarfile.tarfile` attr (GH-149635)
authorsobolevn <mail@sobolevn.me>
Mon, 11 May 2026 10:54:49 +0000 (13:54 +0300)
committerGitHub <noreply@github.com>
Mon, 11 May 2026 10:54:49 +0000 (12:54 +0200)
Doc/whatsnew/3.16.rst
Lib/tarfile.py
Misc/NEWS.d/next/Library/2026-05-10-14-10-00.gh-issue-149634.iT5cwC.rst [new file with mode: 0644]

index 967b3baf530a51d40ccea76301fff084260cb626..6d91d53f478d8eb71cddb7cd5c21a39cf207b725 100644 (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.
 
 
index 1394a26f2096ff69b12622566e8d46d9dd3bf6b3..772b51295fcfbef724cd62f7586fbb238f47974b 100644 (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 @@ class TarInfo(object):
         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 @@ class TarFile(object):
         # 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:
diff --git a/Misc/NEWS.d/next/Library/2026-05-10-14-10-00.gh-issue-149634.iT5cwC.rst b/Misc/NEWS.d/next/Library/2026-05-10-14-10-00.gh-issue-149634.iT5cwC.rst
new file mode 100644 (file)
index 0000000..620b66f
--- /dev/null
@@ -0,0 +1 @@
+Remove deprecated and unused :attr:`!tarfile.Tarfile.tarfile` attribute.