From 6a0df4de474b88fa0e151953540f55cbbe4e0485 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 21 Aug 2026 19:42:37 +0800 Subject: [PATCH] fix(python): return None from unit jobs (#3999) ## Problem Generic job result propagation exposed the PyO3 representation of Rust's unit value as `()` in Python. Unit jobs therefore returned an empty tuple instead of `None`, breaking the documented `Job.wait()` contract and the Python doctest workflow. ## Behavior Unit job completion now converts explicitly to Python `None`. Typed job results continue to pass through unchanged, with synchronous and asynchronous regression coverage. --- python/python/tests/test_table.py | 4 ++-- python/src/job.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/python/tests/test_table.py b/python/python/tests/test_table.py index b28cd9d66..0f98219bf 100644 --- a/python/python/tests/test_table.py +++ b/python/python/tests/test_table.py @@ -3947,7 +3947,7 @@ def test_refresh_column_async_returns_job(tmp_path): job = table.refresh_column_async("doubled") assert job.id is None # in-process jobs have no server id - job.wait() + assert job.wait() is None assert job.status() == "finished" assert sorted(table.to_arrow()["doubled"].to_pylist()) == [2, 4] @@ -3963,6 +3963,6 @@ async def test_refresh_column_async_job_async_table(tmp_path): await table.add_columns(computed={"tripled": "x * 3"}) job = await table.refresh_column_async("tripled") - await job.wait() + assert await job.wait() is None assert await job.status() == "finished" assert (await table.to_arrow())["tripled"].to_pylist() == [9] diff --git a/python/src/job.rs b/python/src/job.rs index 2755a28c5..a08b958a6 100644 --- a/python/src/job.rs +++ b/python/src/job.rs @@ -93,7 +93,7 @@ impl Job { let inner = self_.inner.clone(); future_into_py(self_.py(), async move { inner.wait().await.infer_error()?; - Ok(()) + Ok(None::<()>) }) }