[Python] get_partition_keys segfaults when the partition expression is None
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the bug, including details regarding any error messages, version, and platform.
`pyarrow.dataset.get_partition_keys` takes an `Expression` but does not reject
`None`, so passing it dereferences a null pointer and terminates the interpreter
rather than raising.
```python
import pyarrow.dataset as ds
ds.get_partition_keys(None)
```
```console
$ python -c "import pyarrow.dataset as ds; ds.get_partition_keys(None)"; echo "exit=$?"
Bus error: 10
exit=138
```
The same call through the private alias `ds._get_partition_keys(None)` crashes
identically.
This is the same class of problem as GH-51042 and GH-51043, where a required
Arrow wrapper argument was not declared `not None` at the Cython boundary. A
sweep of the remaining Cython bindings for required wrapper-typed parameters
without `not None` found this as the one still reachable from a public entry
point.
Expected behavior is a `TypeError`, consistent with other typed PyArrow APIs.
PyArrow 25.0.1, CPython 3.11, macOS arm64.
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.