)]}'
{
  "commit": "03a1a9aac4fe904deff653b5ab2be49d8c63cfcc",
  "tree": "a7346443bbbd235acbe7fc2bb63a2e1010fa3d6d",
  "parents": [
    "2e65252f95661e6a542b39fbf00ae3ead0be7fdb"
  ],
  "author": {
    "name": "Régis Desgroppes",
    "email": "rdesgroppes@gmail.com",
    "time": "Wed Aug 19 04:01:28 2026 +0000"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Aug 19 04:01:28 2026 +0000"
  },
  "message": "fix(py_test): fix Windows crash in `py_test` main validation (#4079)\n\n`py_test` main validation (`--validate_test_main\u003denabled`) crashes on\nWindows, because it invokes the interpreter via\n`exec_tools.exec_interpreter`, which resolves through\n`current_interpreter_executable()`\u0027s relocated copy of the interpreter.\n\nThe crash may be reproduced on existing tests in the repo, for instance:\n```\nbazel build \\\n  --@rules_python//python/config_settings:validate_test_main\u003denabled  \\\n  //tests/validate_test_main:validate_test_main_test\n...\nERROR: .../tests/validate_test_main/BUILD.bazel:3:8: Validating py_test\n main //tests/validate_test_main:validate_test_main_test failed:\n (Exit -1073741515): python.exe failed: error executing\n PyValidateTestMain command\n```\n```\ncd tests/integration/validate_test_main\nbazel build \\\n  --@rules_python//python/config_settings:validate_test_main\u003denabled \\\n  //:good_test\n...\nERROR: .../tests/integration/validate_test_main/BUILD.bazel:11:8:\n Validating py_test main //:good_test failed: (Exit -1073741515):\n python.exe failed: error executing PyValidateTestMain command\n```\n\n`-1073741515` is `STATUS_DLL_NOT_FOUND`: the relocated copy can\u0027t find\nits DLLs beside itself.\n\nThis is also the Windows-local manifestation of #2703\n(`exec_interpreter` broken on RBE): the same relocation severs the\ninterpreter from files resolved relative to itself, just triggered\ndifferently: RBE\u0027s copy materialization there, a lack of symlink\nprivilege here.\n\nColocating the DLLs alone (a first attempt) traded this for a second,\nstill fatal error, `ModuleNotFoundError: No module named \u0027encodings\u0027`,\nbecause the copy still can\u0027t find its stdlib.\nPatching each missing file individually doesn\u0027t scale: DLLs today,\nstdlib tomorrow, whatever else a future toolchain needs beside itself\nafter that.\n\n`_maybe_add_test_main_validation` now uses `actions_run()` with\n`exec_runtime` instead of `exec_tools.exec_interpreter`\u0027s relocated\n`DefaultInfo.files_to_run`, matching\n`PyExecToolsInfo.exec_interpreter`\u0027s own documented recommendation and\nthe pattern `common.bzl`\u0027s `actions_run()` and `py_zipapp_rule.bzl`\nalready use.\n`exec_runtime.interpreter` is the real file, used directly, with its\nreal files as plain action inputs, so nothing is relocated and nothing\nloses its siblings.\n\nWith the proposed fix[^1], above examples now build cleanly, with no\nrelocated runfiles tree for the interpreter at all, and\n`tests/integration/validate_test_main`\u0027s `inert_test` still fails with\nits intended \"will not run any tests\" message rather than a crash.\n\n`tests/integration/validate_test_main_test` is the corresponding\nintegration test, but it was not exercised on Windows, where it was\nfailing on `OSError: [WinError 193] %1 is not a valid Win32 application`\nin `tests/integration/runner.py`\u0027s Bazel-in-Bazel invocation, itself\nunable to run `bazel_from_env`\u0027s `#!` shebang line the way POSIX\u0027s\n`exec` does.\nThe present change therefore fixes this, by resolving the shebang\u0027s\ninterpreter itself, and enables the test on Windows.\n\n[^1]: This does not fix `exec_interpreter`/#2703 itself:\n`precompile.bzl` still resolves the interpreter via the relocated path\nand would need the same migration.\n\n---------\n\nCo-authored-by: Richard Levasseur \u003crichardlev@gmail.com\u003e",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7e1c3237ae0c21b06408bffa1e1063574e2887e5",
      "new_mode": 33188,
      "new_path": "news/4079.fixed.md"
    },
    {
      "type": "modify",
      "old_id": "0e7e292aae7e2377c7a74a8bb09d151416ab39e2",
      "old_mode": 33188,
      "old_path": "python/private/py_executable.bzl",
      "new_id": "0e9c315a731d0090b0860ee9476d1aee478cdc1b",
      "new_mode": 33188,
      "new_path": "python/private/py_executable.bzl"
    },
    {
      "type": "modify",
      "old_id": "13b9c2e855ded07b02b4663f05929cc915d0e734",
      "old_mode": 33188,
      "old_path": "tests/integration/BUILD.bazel",
      "new_id": "2eae8dfecb884868e94efa36fb5ff4d349458d8b",
      "new_mode": 33188,
      "new_path": "tests/integration/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "9efcbebb898621af30290294fb52797b93fe5008",
      "old_mode": 33188,
      "old_path": "tests/integration/runner.py",
      "new_id": "23e41f6cf126efad3cee83d55d7035ee0e772445",
      "new_mode": 33188,
      "new_path": "tests/integration/runner.py"
    }
  ]
}
