FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-149634: Remove deprecated and unused `tarfile.Tarfile.tarfile` attr by sobolevn · Pull Request #149635 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.16.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wasn't this tarfile.TarInfo.tarfile (TarInfo vs TarFile)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good catch! It was 🤦‍♂️
PR with the doc fix is incomming. Thank you!

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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated and unused :attr:`!tarfile.Tarfile.tarfile` attribute.
Loading

Back | FazBrowse Home | New Git URL