Revert "Statically link JSON extension in pybind CI"#20
Open
adsharma wants to merge 2 commits into
Open
Conversation
14f60fd to
fe12da7
Compare
This reverts commit 13d6905.
06c518e to
608f5f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: LadybugDB/ladybug#462
Summary
This PR keeps the JSON extension loaded dynamically in Python CI and fixes a C API cleanup issue found while testing that path.
Why this failed
The JSON roundtrip test was segfaulting on CI only after earlier C API scan tests had run. The JSON setup query itself has no parameters, so the crash was unlikely to be caused by the JSON parameter normalization path. The suspicious shared state was the C API Arrow scan adapter added for Python object scans.
For C API scans, the Python wrapper rewrites a parameterized PyArrow/pandas/polars scan into a temporary Arrow-backed table. Before this change, those temp tables were dropped only after successful query execution. If the rewritten query failed after the temp table was created, cleanup was skipped and Arrow C Data Interface objects stayed registered in the native Arrow table registry. That leaked native/PyArrow-backed state could corrupt later unrelated tests, which explains why a later
INSTALL json; LOAD json; ...query was where the process finally crashed.Why the fix works
Connection.execute()now records the C API scan tables that were created during rewrite and drops them in afinallyblock. That makes cleanup happen on both success and failure, while preserving the original query error if cleanup also has trouble during exception unwinding.The added regression test forces this exact failure mode: create a parameterized PyArrow
COPYscan, make the query fail, and assert that_capi_scan_tablesis empty afterward. With the cleanup in place, the focused C API JSON smoke test and the broader CI ordering both pass.Validation
uv run ruff check src_py/connection.py test/test_scan_pyarrow.pyLBUG_PYTHON_BACKEND=capi uv run pytest test/test_scan_pyarrow.py::test_pyarrow_copy_from_failed_query_cleans_capi_scan_table test/test_scan_pyarrow.py::test_pyarrow_copy_from_parameterized_df test/test_json.py::test_to_json_string_param_roundtrip -qLBUG_PYTHON_BACKEND=capi uv run pytest test/test_issue.py test/test_json.py::test_to_json_string_param_roundtrip -q