avoid broken tarfile datafilter (#8649) · python-poetry/poetry@84f7ee3 (original) (raw)

`@@ -298,8 +298,14 @@ def extractall(source: Path, dest: Path, zip: bool) -> None:

`

298

298

`with zipfile.ZipFile(source) as archive:

`

299

299

`archive.extractall(dest)

`

300

300

`else:

`

``

301

`+

These versions of python shipped with a broken tarfile data_filter, per

`

``

302

`+

https://github.com/python/cpython/issues/107845.

`

``

303

`+

broken_tarfile_filter = {(3, 8, 17), (3, 9, 17), (3, 10, 12), (3, 11, 4)}

`

301

304

`with tarfile.open(source) as archive:

`

302

``

`-

if hasattr(tarfile, "data_filter"):

`

``

305

`+

if (

`

``

306

`+

hasattr(tarfile, "data_filter")

`

``

307

`+

and sys.version_info[:3] not in broken_tarfile_filter

`

``

308

`+

):

`

303

309

`archive.extractall(dest, filter="data")

`

304

310

`else:

`

305

311

`archive.extractall(dest)

`