)]}'
{
  "commit": "c41ff82deb8140b41b129d4d1b3a3640ac06dc52",
  "tree": "70445366a2a65f5b7c6dc1dd0d1661b7eefef281",
  "parents": [
    "a197de0e81e73648b309812a8723493d8cedd53e"
  ],
  "author": {
    "name": "jameswillis",
    "email": "james@wherobots.com",
    "time": "Fri Sep 11 16:09:08 2026 +0900"
  },
  "committer": {
    "name": "Hyukjin Kwon",
    "email": "hyukjin.kwon@databricks.com",
    "time": "Fri Sep 11 16:09:08 2026 +0900"
  },
  "message": "[SPARK-59432][CONNECT][PYTHON] Declare gil_used \u003d false on the _pyspark module\n\n### What changes were proposed in this pull request?\n\nDeclare `#[pymodule(gil_used \u003d false)]` on the `_pyspark` module in `crates/pyspark-rs/src/lib.rs`, opting the `pyspark-client-rust` extension into free-threaded (no-GIL) CPython.\n\nThis is the first of the two steps identified in [SPARK-59432](https://issues.apache.org/jira/browse/SPARK-59432). The second — adding a free-threaded (`cp313t`/`cp314t`) wheel build leg — is a separate build/packaging change (abi3 and the free-threaded ABI are mutually exclusive) and is left as a follow-up.\n\n### Why are the changes needed?\nThe original justificationfor this PR is struck out below but as Hyukjin points out in his comment, pyo3 flipped the default of this variable to false so this is effectively a no-op! So this PR only serves to make it explicit in the code that no-gil is supported.\n\n~On a free-threaded interpreter (CPython 3.13t/3.14t, PEP 703), CPython re-enables the GIL process-wide when it imports a PyO3 extension module that has not declared `gil_used \u003d false`. A pure-Rust (tonic) Spark Connect client is well positioned to run with the GIL disabled — it pulls in no `grpcio`, which otherwise re-enables the GIL on import — so this declaration is a prerequisite for the extension to run GIL-off.~\n\n~The declaration is truthful: the extension is already thread-safe. details in Jira ticket.~\n\n### Does this PR introduce _any_ user-facing change?\n\nNo. The attribute is a no-op on GIL-enabled interpreters. It has no runtime effect until a free-threaded wheel is published — the current wheels are `cp39-abi3`, which are not selectable on a free-threaded interpreter — and that wheel build leg is the tracked follow-up.\n\n### How was this patch tested?\n\nExisting CI (`cargo fmt --all --check` and the workspace build); the attribute is inert on GIL-enabled builds and compiles under the current pyo3 0.28. End-to-end verification that the GIL is actually disabled (`sys._is_gil_enabled() is False`) will be added together with the free-threaded wheel build leg in the follow-up.\n\n### Was this patch authored or co-authored using generative AI tooling?\n\nGenerated-by: Claude Code (Anthropic)\n\nCloses #100 from james-willis/spark-59432-gil-used-false.\n\nAuthored-by: jameswillis \u003cjames@wherobots.com\u003e\nSigned-off-by: Hyukjin Kwon \u003chyukjin.kwon@databricks.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "30ccac7d8fa5a38ace48134a901926535ba39b7b",
      "old_mode": 33188,
      "old_path": "crates/pyspark-rs/src/lib.rs",
      "new_id": "43a850f471a8f2aa7f3d134df66e918b6c1011a7",
      "new_mode": 33188,
      "new_path": "crates/pyspark-rs/src/lib.rs"
    }
  ]
}
