From d6138f59f35bef619db9c071a45f9c13956c1571 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 5 Sep 2023 21:55:51 -0400 Subject: [PATCH] fix: avoid bug in various patch releases of Python Signed-off-by: Henry Schreiner --- src/build/_util.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/build/_util.py b/src/build/_util.py index 0582a283..5ed87f13 100644 --- a/src/build/_util.py +++ b/src/build/_util.py @@ -71,8 +71,15 @@ def parse_wheel_filename(filename: str) -> re.Match[str] | None: else: # Per https://peps.python.org/pep-0706/, the "data" filter will become - # the default in Python 3.14. - if sys.version_info < (3, 14) and hasattr(tarfile, 'data_filter'): + # the default in Python 3.14. The first series of releases with the filter + # had a broken filter that could not process symlinks correctly. + if ( + (3, 8, 19) <= sys.version_info < (3, 9) + or (3, 9, 19) <= sys.version_info < (3, 10) + or (3, 10, 13) <= sys.version_info < (3, 11) + or (3, 11, 5) < sys.version_info < (3, 12) + or (3, 12) <= sys.version_info < (3, 14) + ): class TarFile(tarfile.TarFile): extraction_filter = staticmethod(tarfile.data_filter)