Skip to content

Commit 033e4f8

Browse files
authored
Merge pull request #775 from pypa/tarfile-filter
Use tarfile filter on Python >= 3.12 when extracting sdist
2 parents f36a6c3 + bdbab91 commit 033e4f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flit/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
def unpacked_tarball(path):
2222
tf = tarfile.open(str(path))
2323
with TemporaryDirectory() as tmpdir:
24-
tf.extractall(tmpdir)
24+
# Py >=3.12: restrict advanced tar features which sdists shouldn't use
25+
kw = {'filter': 'data'} if hasattr(tarfile, 'data_filter') else {}
26+
tf.extractall(tmpdir, **kw)
2527
files = os.listdir(tmpdir)
2628
assert len(files) == 1, files
2729
yield os.path.join(tmpdir, files[0])

0 commit comments

Comments
 (0)