From 956c3eaf3c1ec21e0ae133330eed2d8bc88e86ec Mon Sep 17 00:00:00 2001 From: yusufipk Date: Sat, 5 Sep 2026 09:16:49 +0300 Subject: [PATCH] Leave the tar extraction fallback where it was Refusing the install on a Python without the extraction filters is a change to how every archive on every platform is unpacked, and it has nothing to do with shipping a Vulkan whisper-server. On those Pythons the download stops working altogether, which is a worse answer than the one that was there. Worth doing on its own terms, in its own change, where the versions it turns away can be argued about without a backend release riding on it. --- dikte/ggml.py | 7 ++----- tests/test_ggml.py | 12 ------------ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/dikte/ggml.py b/dikte/ggml.py index 792a72d..00e9929 100644 --- a/dikte/ggml.py +++ b/dikte/ggml.py @@ -353,11 +353,8 @@ def _extract(archive, into): with tarfile.open(archive, "r:gz") as tar: try: tar.extractall(into, filter="data") - except TypeError as exc: # Python 3.11.0-3 lack extraction filters - raise LocalError(t( - "Could not safely unpack {name} with this Python version", - name=os.path.basename(str(archive)), - )) from exc + except TypeError: # Python without the extraction filters + tar.extractall(into) except (tarfile.TarError, zipfile.BadZipFile, OSError) as exc: raise LocalError(t("Could not unpack {name}: {error}", name=os.path.basename(str(archive)), error=exc)) from exc diff --git a/tests/test_ggml.py b/tests/test_ggml.py index e97254f..184f6fc 100644 --- a/tests/test_ggml.py +++ b/tests/test_ggml.py @@ -500,18 +500,6 @@ class InstallProgram(Local): with self.assertRaises(ggml.LocalError): self.install("whisper-bin-ubuntu-x64.tar.gz", archive=buf.getvalue()) - def test_python_without_safe_tar_filters_refuses_the_archive(self): - archive = self.path("bundle.tar.gz") - archive.write_bytes(self.archive) - destination = self.path("unpacked") - destination.mkdir() - with mock.patch.object(tarfile.TarFile, "extractall", - side_effect=[TypeError("no filter"), None]) as extract: - with self.assertRaises(ggml.LocalError) as caught: - ggml._extract(archive, destination) - self.assertEqual(1, extract.call_count) - self.assertIn("safely", str(caught.exception)) - def test_everything_is_asked_for_over_tls(self): for url in (hub.GITHUB_API, hub.HF_API, hub.HF_FILES): with self.subTest(url=url):