Skip to content

Commit 7ebac27

Browse files
committed
Don't pass in hte filter argument to tar.extractall on old Python versions
Signed-off-by: Bernát Gábor <[email protected]>
1 parent c836ab2 commit 7ebac27

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/changelog/3568.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Don't pass in the filter argument to tar.extractall on old Python versions - by :user:`gaborbernat`.

src/tox/tox_env/python/virtual_env/package/cmd_builder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ def extract_install_info(self, for_env: EnvConfigSet, path: Path) -> list[Packag
108108
if not work_dir.exists(): # pragma: no branch
109109
work_dir.mkdir()
110110
with tarfile.open(str(path), "r:gz") as tar:
111-
tar.extractall( # noqa: S202
112-
path=str(work_dir),
113-
filter=tarfile.data_filter
114-
if sys.version_info >= (3, 11, 4)
111+
kwargs = {}
112+
if (
113+
sys.version_info >= (3, 11, 4)
115114
or (3, 10, 12) <= sys.version_info < (3, 11)
116115
or (3, 9, 17) <= sys.version_info < (3, 10)
117-
else None,
118-
)
116+
) is not None:
117+
kwargs["filter"] = tarfile.data_filter
118+
tar.extractall(path=str(work_dir), **kwargs) # type: ignore[arg-type] # noqa: S202
119119
# the register run env is guaranteed to be called before this
120120
assert self._sdist_meta_tox_env is not None # noqa: S101
121121
with self._sdist_meta_tox_env.display_context(self._has_display_suspended):

0 commit comments

Comments
 (0)