Skip to content

Commit b2f7a44

Browse files
encukoumcepl
authored andcommitted
Remove the DeprecationWarning
1 parent 10a05d8 commit b2f7a44

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

Lib/tarfile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,11 +2214,6 @@ def _get_filter_function(self, filter):
22142214
if filter is None:
22152215
filter = self.extraction_filter
22162216
if filter is None:
2217-
warnings.warn(
2218-
'Python 3.14 will, by default, filter extracted tar '
2219-
+ 'archives and reject files or modify their metadata. '
2220-
+ 'Use the filter argument to control this behavior.',
2221-
DeprecationWarning)
22222217
return fully_trusted_filter
22232218
if isinstance(filter, str):
22242219
raise TypeError(

Lib/test/test_shutil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,8 +1645,7 @@ def check_unpack_archive_with_converter(self, format, converter, **kwargs):
16451645
def check_unpack_tarball(self, format):
16461646
self.check_unpack_archive(format, filter='fully_trusted')
16471647
self.check_unpack_archive(format, filter='data')
1648-
with warnings_helper.check_warnings(
1649-
('Python 3.14', DeprecationWarning)):
1648+
with warnings_helper.check_no_warnings(self):
16501649
self.check_unpack_archive(format)
16511650

16521651
def test_unpack_archive_tar(self):

Lib/test/test_tarfile.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import io
44
from hashlib import sha256
5-
from contextlib import contextmanager, ExitStack
5+
from contextlib import contextmanager
66
from random import Random
77
import pathlib
88
import shutil
@@ -2964,11 +2964,7 @@ def setUpClass(cls):
29642964
tar = tarfile.open(tarname, mode='r', encoding="iso8859-1")
29652965
cls.control_dir = pathlib.Path(TEMPDIR) / "extractall_ctrl"
29662966
tar.errorlevel = 0
2967-
with ExitStack() as cm:
2968-
if cls.extraction_filter is None:
2969-
cm.enter_context(warnings.catch_warnings(
2970-
action="ignore", category=DeprecationWarning))
2971-
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
2967+
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
29722968
tar.close()
29732969
cls.control_paths = set(
29742970
p.relative_to(cls.control_dir)
@@ -3602,12 +3598,11 @@ def test_data_filter(self):
36023598
self.assertIs(filtered.name, tarinfo.name)
36033599
self.assertIs(filtered.type, tarinfo.type)
36043600

3605-
def test_default_filter_warns(self):
3606-
"""Ensure the default filter warns"""
3601+
def test_default_filter_warns_not(self):
3602+
"""Ensure the default filter does not warn (like in 3.12)"""
36073603
with ArchiveMaker() as arc:
36083604
arc.add('foo')
3609-
with warnings_helper.check_warnings(
3610-
('Python 3.14', DeprecationWarning)):
3605+
with warnings_helper.check_no_warnings(self):
36113606
with self.check_context(arc.open(), None):
36123607
self.expect_file('foo')
36133608

0 commit comments

Comments
 (0)