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

    ./build/test/functional/test_runner.py interface_ipc.py
    Temporary test directory at /tmp/test_runner_₿_🏃_20260319_142327
    Remaining jobs: [interface_ipc.py]
    1/1 - interface_ipc.py failed, Duration: 2 s
    
    stdout:
    2026-03-19T18:23:27.330123Z TestFramework (INFO): PRNG seed is: 4933091336597497631
    2026-03-19T18:23:27.380917Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20260319_142327/interface_ipc_0
    2026-03-19T18:23:28.625944Z TestFramework (INFO): Running echo test
    2026-03-19T18:23:28.635856Z TestFramework (INFO): Running mining test
    2026-03-19T18:23:28.648965Z TestFramework (INFO): Running deprecated mining interface test
    2026-03-19T18:23:28.653589Z TestFramework (INFO): Running disconnect during BlockTemplate.waitNext
    2026-03-19T18:23:28.821124Z TestFramework (INFO): Running thread busy test
    2026-03-19T18:23:29.195589Z TestFramework (INFO): Stopping nodes
    2026-03-19T18:23:29.299135Z TestFramework (INFO): Cleaning up /tmp/test_runner_₿_🏃_20260319_142327/interface_ipc_0 on exit
    2026-03-19T18:23:29.299329Z TestFramework (INFO): Tests successful
    
    
    stderr:
    <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.
    
    
    
    TEST             | STATUS    | DURATION
    
    interface_ipc.py | ✖ Failed  | 2 s
    
    ALL              | ✖ Failed  | 2 s (accumulated) 
    Runtime: 2 s
    
    

    After

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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, fanquake

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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-05-01 15:12 UTC

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