Skip to content
Closed
Prev Previous commit
Next Next commit
Downgrade to Python 3.6
  • Loading branch information
encukou committed May 17, 2023
commit 9106981373c485e0105f33fe087ae691f32a24bf
3 changes: 2 additions & 1 deletion Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ def unpack_archive(filename, extract_dir=None, format=None, *, filter=None):
raise ReadError("Unknown archive format '{0}'".format(filename))

func = _UNPACK_FORMATS[format][1]
kwargs = dict(_UNPACK_FORMATS[format][2]) | filter_kwargs
kwargs = dict(_UNPACK_FORMATS[format][2])
kwargs.update(filter_kwargs)
func(filename, extract_dir, **kwargs)


Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from test import support
from test.support import TESTFN, FakePath
from test.support import warnings_helper

TESTFN2 = TESTFN + "2"

Expand Down Expand Up @@ -1276,7 +1275,7 @@ def check_unpack_archive_with_converter(self, format, converter, **kwargs):
def check_unpack_tarball(self, format):
self.check_unpack_archive(format, filter='fully_trusted')
self.check_unpack_archive(format, filter='data')
with warnings_helper.check_warnings(
with support.check_warnings(
('The default', RuntimeWarning)):
self.check_unpack_archive(format)

Expand Down
12 changes: 5 additions & 7 deletions Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from test import support
from test.support import script_helper
from test.support import warnings_helper

# Check for our compression modules.
try:
Expand Down Expand Up @@ -2729,8 +2728,7 @@ def setUpClass(cls):
tar.errorlevel = 0
with ExitStack() as cm:
if cls.extraction_filter is None:
cm.enter_context(warnings.catch_warnings(
action="ignore", category=DeprecationWarning))
cm.enter_context(warnings.catch_warnings())
tar.extractall(cls.control_dir, filter=cls.extraction_filter)
tar.close()
cls.control_paths = set(
Expand Down Expand Up @@ -2860,8 +2858,8 @@ def test_list(self):
for attr_names in ({'mtime'}, {'mode'}, {'uid'}, {'gid'},
{'uname'}, {'gname'},
{'uid', 'uname'}, {'gid', 'gname'}):
with (self.subTest(attr_names=attr_names),
tarfile.open(tarname, encoding="iso8859-1") as tar):
with self.subTest(attr_names=attr_names), \
tarfile.open(tarname, encoding="iso8859-1") as tar:
tio_prev = io.TextIOWrapper(io.BytesIO(), 'ascii', newline='\n')
with support.swap_attr(sys, 'stdout', tio_prev):
tar.list()
Expand Down Expand Up @@ -3052,7 +3050,7 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
if type is None and isinstance(name, str) and name.endswith('/'):
type = tarfile.DIRTYPE
if symlink_to is not None:
got = (self.destdir / name).readlink()
got = pathlib.Path(os.readlink(self.destdir / name))
expected = pathlib.Path(symlink_to)
# The symlink might be the same (textually) as what we expect,
# but some systems change the link to an equivalent path, so
Expand Down Expand Up @@ -3369,7 +3367,7 @@ def test_default_filter_warns(self):
"""Ensure the default filter warns"""
with ArchiveMaker() as arc:
arc.add('foo')
with warnings_helper.check_warnings(
with support.check_warnings(
('Python 3.14', DeprecationWarning)):
with self.check_context(arc.open(), None):
self.expect_file('foo')
Expand Down