tests: applied PYTHON_GIL to the env for every test #34869

pull kevkevinpal wants to merge 1 commits into bitcoin:master from kevkevinpal:usePythonGILInTests changing 1 files +5 −0
  1. kevkevinpal commented at 6:25 pm on March 19, 2026: contributor

    Summay

    If a user is running python3.14.0t they would see a warning log that would fail the integration test suite.

    This change adds PYTHON_GIL=1 to the env when running our functional test suite to ensure that the tests pass for users running python3.14.0t and are not manually setting PYTHON_GIL=1.

    This resolves #33582

    Tests before and after

    Before

     0./build/test/functional/test_runner.py interface_ipc.py
     1Temporary test directory at /tmp/test_runner__🏃_20260319_142327
     2Remaining jobs: [interface_ipc.py]
     31/1 - interface_ipc.py failed, Duration: 2 s
     4
     5stdout:
     62026-03-19T18:23:27.330123Z TestFramework (INFO): PRNG seed is: 4933091336597497631
     72026-03-19T18:23:27.380917Z TestFramework (INFO): Initializing test directory /tmp/test_runner__🏃_20260319_142327/interface_ipc_0
     82026-03-19T18:23:28.625944Z TestFramework (INFO): Running echo test
     92026-03-19T18:23:28.635856Z TestFramework (INFO): Running mining test
    102026-03-19T18:23:28.648965Z TestFramework (INFO): Running deprecated mining interface test
    112026-03-19T18:23:28.653589Z TestFramework (INFO): Running disconnect during BlockTemplate.waitNext
    122026-03-19T18:23:28.821124Z TestFramework (INFO): Running thread busy test
    132026-03-19T18:23:29.195589Z TestFramework (INFO): Stopping nodes
    142026-03-19T18:23:29.299135Z TestFramework (INFO): Cleaning up /tmp/test_runner__🏃_20260319_142327/interface_ipc_0 on exit
    152026-03-19T18:23:29.299329Z TestFramework (INFO): Tests successful
    16
    17
    18stderr:
    19<frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'capnp.lib.capnp', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
    20
    21
    22
    23TEST             | STATUS    | DURATION
    24
    25interface_ipc.py |  Failed  | 2 s
    26
    27ALL              |  Failed  | 2 s (accumulated) 
    28Runtime: 2 s
    

    After

     0./build/test/functional/test_runner.py interface_ipc.py
     1Temporary test directory at /tmp/test_runner_₿_🏃_20260319_142221
     2Remaining jobs: [interface_ipc.py]
     31/1 - interface_ipc.py passed, Duration: 2 s
     4
     5TEST             | STATUS    | DURATION
     6
     7interface_ipc.py | ✓ Passed  | 2 s
     8
     9ALL              | ✓ Passed  | 2 s (accumulated) 
    10Runtime: 2 s
    
  2. DrahtBot added the label Tests on Mar 19, 2026
  3. DrahtBot commented at 6:26 pm on March 19, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, fanquake

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. tests: applied PYTHON_GIL to the env for every test b14f2c76a1
  5. in test/functional/test_runner.py:616 in c71d36c6bc
    608@@ -609,6 +609,12 @@ def run_tests(*, test_list, build_dir, tmpdir, jobs=1, enable_coverage=False, ar
    609     # a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561.
    610     sys.path.append(tests_dir)
    611 
    612+    # Some optional Python dependencies (e.g. pycapnp) may emit warnings or fail under
    613+    # CPython free-threaded builds when the GIL is disabled. Force it on for all
    614+    # functional tests to keep the suite deterministic.
    615+    run_env = os.environ.copy()
    616+    run_env["PYTHON_GIL"] = "1"
    


    maflcko commented at 6:59 pm on March 19, 2026:
    i think you can just modify the global, to avoid having to pass it down?

    kevkevinpal commented at 7:22 pm on March 19, 2026:

    That is much simpler thanks for the suggestion

    I updated to that in b14f2c7

  6. kevkevinpal force-pushed on Mar 19, 2026
  7. maflcko commented at 7:31 pm on March 19, 2026: member
    review ACK b14f2c76a1f6b41835c134584c82c45704c4cce0
  8. fanquake added the label Needs Backport (31.x) on Mar 20, 2026
  9. fanquake added the label Needs backport (30.x) on Mar 20, 2026
  10. fanquake commented at 3:18 am on March 20, 2026: member
    ACK b14f2c76a1f6b41835c134584c82c45704c4cce0
  11. fanquake merged this on Mar 20, 2026
  12. fanquake closed this on Mar 20, 2026

  13. fanquake referenced this in commit 7118559f8c on Mar 20, 2026
  14. fanquake referenced this in commit 72d2b85414 on Mar 20, 2026
  15. fanquake removed the label Needs Backport (31.x) on Mar 20, 2026
  16. fanquake commented at 3:22 am on March 20, 2026: member
    Backported to 31.x in #34800.
  17. fanquake commented at 3:22 am on March 20, 2026: member
    Backported to 30.x in #34856.
  18. fanquake removed the label Needs backport (30.x) on Mar 20, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-20 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me