1fanwang opened a new pull request, #51247:
URL: https://github.com/apache/arrow/pull/51247
### Rationale for this change
`pyarrow.compute.call_tabular_function()` takes an optional registry
argument. Passing the wrong Python type reaches an unchecked Cython cast to the
native registry pointer, and the process dies with a SIGSEGV before Arrow can
raise anything an application could catch.
### What changes are included in this PR?
The binding validates the registry argument before the cast. A value of the
wrong type raises `TypeError("func_registry must be a FunctionRegistry")`.
### Are these changes tested?
Yes. The regression drives the call in a subprocess so a crash is observable
rather than fatal to the test run.
```console
$ git checkout main -- python/pyarrow/_compute.pyx && python -m pytest \
python/pyarrow/tests/test_compute.py -k tabular_function_rejects -q
E subprocess.CalledProcessError: Command '[...]' died with
<Signals.SIGSEGV: 11>.
1 failed, 604 deselected in 0.56s
$ git checkout HEAD -- python/pyarrow/_compute.pyx && python -m pytest \
python/pyarrow/tests/test_compute.py -k 'tabular_function_rejects or
list_functions' -q
2 passed, 603 deselected in 0.30s
```
### Are there any user-facing changes?
Yes. An invalid registry argument now raises `TypeError` instead of
terminating the process.
**This PR contains a "Critical Fix".** It fixes a process crash reachable
from ordinary Python input.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]