Skip to content

Commit ce00e6d

Browse files
committed
Remove the DeprecationWarning
1 parent 0b33106 commit ce00e6d

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
@@ -1665,8 +1665,7 @@ def check_unpack_archive_with_converter(self, format, converter, **kwargs):
16651665
def check_unpack_tarball(self, format):
16661666
self.check_unpack_archive(format, filter='fully_trusted')
16671667
self.check_unpack_archive(format, filter='data')
1668-
with warnings_helper.check_warnings(
1669-
('Python 3.14', DeprecationWarning)):
1668+
with warnings_helper.check_no_warnings(self):
16701669
self.check_unpack_archive(format)
16711670

16721671
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
@@ -2994,11 +2994,7 @@ def setUpClass(cls):
29942994
tar = tarfile.open(tarname, mode='r', encoding="iso8859-1")
29952995
cls.control_dir = pathlib.Path(TEMPDIR) / "extractall_ctrl"
29962996
tar.errorlevel = 0
2997-
with ExitStack() as cm:
2998-
if cls.extraction_filter is None:
2999-
cm.enter_context(warnings.catch_warnings(
3000-
action="ignore", category=DeprecationWarning))
3001-
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
2997+
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
30022998
tar.close()
30032999
cls.control_paths = set(
30043000
p.relative_to(cls.control_dir)
@@ -3649,12 +3645,11 @@ def test_data_filter(self):
36493645
self.assertIs(filtered.name, tarinfo.name)
36503646
self.assertIs(filtered.type, tarinfo.type)
36513647

3652-
def test_default_filter_warns(self):
3653-
"""Ensure the default filter warns"""
3648+
def test_default_filter_warns_not(self):
3649+
"""Ensure the default filter does not warn (like in 3.12)"""
36543650
with ArchiveMaker() as arc:
36553651
arc.add('foo')
3656-
with warnings_helper.check_warnings(
3657-
('Python 3.14', DeprecationWarning)):
3652+
with warnings_helper.check_no_warnings(self):
36583653
with self.check_context(arc.open(), None):
36593654
self.expect_file('foo')
36603655

0 commit comments

Comments
 (0)