Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-76007: Deprecatetarfile.version#145326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 2 commits intopython:mainfromStanFromIreland:tarfile-version
Feb 27, 2026
Merged
Show file tree
Hide file tree
Changes fromall 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
1 change: 1 addition & 0 deletionsDoc/deprecations/pending-removal-in-3.20.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ Pending removal in Python 3.20
- :mod:`re`
- :mod:`socketserver`
- :mod:`tabnanny`
- :mod:`tarfile`
- :mod:`tkinter.font`
- :mod:`tkinter.ttk`
- :mod:`wsgiref.simple_server`
Expand Down
1 change: 1 addition & 0 deletionsDoc/whatsnew/3.15.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1549,6 +1549,7 @@ New deprecations
- :mod:`re`
- :mod:`socketserver`
- :mod:`tabnanny`
- :mod:`tarfile`
- :mod:`tkinter.font`
- :mod:`tkinter.ttk`
- :mod:`wsgiref.simple_server`
Expand Down
11 changes: 10 additions & 1 deletionLib/tarfile.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,6 @@
"""Read from and write to tar format archives.
"""

version="0.9.0"
__author__="Lars Gust\u00e4bel (lars@gustaebel.de)"
__credits__="Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."

Expand DownExpand Up@@ -3137,5 +3136,15 @@ def main():
ifargs.verbose:
print('{!r} file created.'.format(tar_name))


def__getattr__(name):
ifname=="version":
fromwarningsimport_deprecated

_deprecated("version",remove=(3,20))
return"0.9.0"# Do not change
raiseAttributeError(f"module{__name__!r} has no attribute{name!r}")


if__name__=='__main__':
main()
10 changes: 10 additions & 0 deletionsLib/test/test_tarfile.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4836,6 +4836,16 @@ def test_ignore_invalid_offset_headers(self):
self.assertEqual(members[0].offset,expected_offset)


classTestModule(unittest.TestCase):
deftest_deprecated_version(self):
withself.assertWarnsRegex(
DeprecationWarning,
"'version' is deprecated and slated for removal in Python 3.20",
)ascm:
getattr(tarfile,"version")
self.assertEqual(cm.filename,__file__)


defsetUpModule():
os_helper.unlink(TEMPDIR)
os.makedirs(TEMPDIR)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
The ``version`` attribute of the :mod:`tarfile` module is deprecated and
slated for removal in Python 3.20.
Loading

[8]ページ先頭

©2009-2026 Movatter.jp