Visitar URL original
[3.7] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) by encukou · Pull Request #104583 · python/cpython · GitHub
Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Skip chmod checking on Windows
  • Loading branch information
encukou committed May 17, 2023
commit fc9913db5bd7e0dfd676f8bafc69f837d31037b8
7 changes: 6 additions & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3049,9 +3049,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
path = pathlib.Path(os.path.normpath(self.destdir / name))
self.assertIn(path, self.expected_paths)
self.expected_paths.remove(path)
if mode is not None:

# When checking mode, ignore Windows (which can only set user read and
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
# instead of hardcoding Windows.
if mode is not None and sys.platform != 'win32':
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
self.assertEqual(got, mode)

if type is None and isinstance(name, str) and name.endswith('/'):
type = tarfile.DIRTYPE
if symlink_to is not None:
Expand Down