From 6f3285605a10c299ea6fa710ff0f5508a36ac208 Mon Sep 17 00:00:00 2001 From: Borja Castellano Date: Tue, 12 May 2026 14:11:34 -0700 Subject: [PATCH] chore(setup-dashd): require Python 3.12+ at script start `tarfile.extractall(..., filter="data")` is only available on Python 3.12+. Failing fast with a clear message avoids a cryptic mid-download `TypeError` when the script is run on an older interpreter. Co-Authored-By: Claude Opus 4.7 (1M context) --- contrib/setup-dashd.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contrib/setup-dashd.py b/contrib/setup-dashd.py index ea056258b..edee2dce8 100755 --- a/contrib/setup-dashd.py +++ b/contrib/setup-dashd.py @@ -20,6 +20,18 @@ import urllib.request import zipfile +# Minimum Python version: `tarfile.extractall(..., filter="data")` was added +# in Python 3.12. Fail fast with a clear message instead of letting the +# extraction step crash mid-download with a cryptic `TypeError`. +MIN_PYTHON = (3, 12) +if sys.version_info < MIN_PYTHON: + sys.stderr.write( + "setup-dashd.py requires Python " + f"{MIN_PYTHON[0]}.{MIN_PYTHON[1]}+ " + f"(found {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}).\n" + ) + sys.exit(1) + # Keep these defaults in sync with .github/workflows/build-and-test.yml DASHVERSION = os.environ.get("DASHVERSION", "23.1.0") TEST_DATA_VERSION = os.environ.get("TEST_DATA_VERSION", "v0.0.4")