From 8b6b5a31685222dbce5e1b0004809a4926ebab80 Mon Sep 17 00:00:00 2001 From: jameswillis Date: Thu, 10 Sep 2026 21:15:10 -0700 Subject: [PATCH] [SPARK-59432][CONNECT][PYTHON] Declare gil_used = false on the _pyspark module Opt the pyspark-client-rust extension into free-threaded (no-GIL) CPython. On a free-threaded interpreter (PEP 703) CPython re-enables the GIL process-wide when it imports a PyO3 extension that has not declared gil_used = false. The extension is already thread-safe, so the declaration is truthful; it is a no-op on GIL-enabled builds. Building the free-threaded (cp3xxt) wheels is tracked as a follow-up. --- crates/pyspark-rs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/pyspark-rs/src/lib.rs b/crates/pyspark-rs/src/lib.rs index 30ccac7d..43a850f4 100644 --- a/crates/pyspark-rs/src/lib.rs +++ b/crates/pyspark-rs/src/lib.rs @@ -88,7 +88,7 @@ use types::{ }; use window::{PyFrameBound, PyWindow, PyWindowSpec}; -#[pymodule] +#[pymodule(gil_used = false)] fn _pyspark(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; m.add_class::()?;