tests: applied PYTHON_GIL to the env for every test
What changed, and why it matters
This commit changes only the internal test runner for Bitcoin Core. It forces Python's Global Interpreter Lock (GIL) to be enabled when running functional tests, because some optional Python libraries used during testing can misbehave or print warnings on newer 'free-threaded' Python builds where the GIL is disabled by default. There is no change to Bitcoin Core's production code, network behavior, wallet handling, or consensus logic.
No security action required. Treat as a normal test-infrastructure maintenance commit.
Security signals we found
No security-relevant code change: only test infrastructure modified
No input handling, cryptography, network parsing, or consensus code touched
Change is a defensive compatibility fix for test tooling, not a vulnerability patch
Evidence from the diff
The patch adds a single line in test/functional/test_runner.py that sets os.environ[‘PYTHON_GIL’] = ‘1’ before launching functional tests. This ensures every child test process inherits the environment variable, keeping the GIL enabled under CPython free-threaded/no-GIL builds. The stated motivation is compatibility/stability for optional test dependencies such as pycapnp. The change is confined to the test harness and does not alter bitcoind, the RPC interface, P2P protocol, or any shipped binary.
Changed components
test/functional/test_runner.pyInspect captured patch +5 / −0
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index a4052f91..cef49a38 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -584,6 +584,11 @@ def main():
def run_tests(*, test_list, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, results_filepath=None):
args = args or []
+ # Some optional Python dependencies (e.g. pycapnp) may emit warnings or fail under
+ # CPython free-threaded builds when the GIL is disabled. Force it on for all
+ # functional tests so every child process inherits PYTHON_GIL=1.
+ os.environ["PYTHON_GIL"] = "1"
+
# Warn if bitcoind is already running
try:
# pgrep exits with code zero when one or more matching processes found
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.