Skip to content

Commit e59fc7a

Browse files
encukoumcepl
authored andcommitted
Remove the DeprecationWarning
1 parent 44c4b4f commit e59fc7a

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

Lib/tarfile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,11 +2174,6 @@ def _get_filter_function(self, filter):
21742174
if filter is None:
21752175
filter = self.extraction_filter
21762176
if filter is None:
2177-
warnings.warn(
2178-
'Python 3.14 will, by default, filter extracted tar '
2179-
+ 'archives and reject files or modify their metadata. '
2180-
+ 'Use the filter argument to control this behavior.',
2181-
DeprecationWarning)
21822177
return fully_trusted_filter
21832178
if isinstance(filter, str):
21842179
raise TypeError(

Lib/test/test_shutil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,7 @@ def check_unpack_archive_with_converter(self, format, converter, **kwargs):
12691269
def check_unpack_tarball(self, format):
12701270
self.check_unpack_archive(format, filter='fully_trusted')
12711271
self.check_unpack_archive(format, filter='data')
1272-
with support.check_warnings(
1273-
('The default', RuntimeWarning)):
1272+
with support.check_no_warnings(self):
12741273
self.check_unpack_archive(format)
12751274

12761275
def test_unpack_archive_tar(self):

Lib/test/test_tarfile.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import io
44
from hashlib import md5
5-
from contextlib import contextmanager, ExitStack
5+
from contextlib import contextmanager
66
from random import Random
77
import pathlib
88
import shutil
@@ -2708,10 +2708,7 @@ def setUpClass(cls):
27082708
tar = tarfile.open(tarname, mode='r', encoding="iso8859-1")
27092709
cls.control_dir = pathlib.Path(TEMPDIR) / "extractall_ctrl"
27102710
tar.errorlevel = 0
2711-
with ExitStack() as cm:
2712-
if cls.extraction_filter is None:
2713-
cm.enter_context(warnings.catch_warnings())
2714-
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
2711+
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
27152712
tar.close()
27162713
cls.control_paths = set(
27172714
p.relative_to(cls.control_dir)
@@ -3345,12 +3342,11 @@ def test_data_filter(self):
33453342
self.assertIs(filtered.name, tarinfo.name)
33463343
self.assertIs(filtered.type, tarinfo.type)
33473344

3348-
def test_default_filter_warns(self):
3349-
"""Ensure the default filter warns"""
3345+
def test_default_filter_warns_not(self):
3346+
"""Ensure the default filter does not warn (like in 3.12)"""
33503347
with ArchiveMaker() as arc:
33513348
arc.add('foo')
3352-
with support.check_warnings(
3353-
('Python 3.14', DeprecationWarning)):
3349+
with support.check_no_warnings(self):
33543350
with self.check_context(arc.open(), None):
33553351
self.expect_file('foo')
33563352

0 commit comments

Comments
 (0)