1fanwang opened a new pull request, #51161: URL: https://github.com/apache/arrow/pull/51161
### Rationale for this change Passing `None` to several required PyArrow object arguments can dereference a null C++ pointer and terminate the Python process. These calls should reject invalid input with `TypeError`, consistent with other typed PyArrow APIs. Fixes https://github.com/apache/arrow/issues/51043. ### What changes are included in this PR? Required `Schema`, `FileFormat`, and `DataType` arguments now reject `None` at the Cython boundary. `FileSystemDataset` also rejects a `None` fragment before unwrapping it. ### Are these changes tested? The reported calls were run in separate Python processes against PyArrow 25.0.1, then covered by focused tests against the patched source. <details> <summary>Raw logs</summary> ```text $ python -c 'import pyarrow.parquet as pq; pq.SortingColumn.from_ordering(None, [])' Segmentation fault: 11 $ echo $? 139 $ python -c 'import pyarrow as pa; import pyarrow.dataset as ds; ds.FileSystemDataset([None], pa.schema([]), ds.ParquetFileFormat())' Segmentation fault: 11 $ echo $? 139 $ python -c 'import pyarrow as pa; d=pa.array([], type=pa.string()); pa.DictionaryArray.from_buffers(None, 0, [None, pa.py_buffer(b"")], d)' Segmentation fault: 11 $ echo $? 139 $ pytest -q python/pyarrow/tests/parquet/test_metadata.py::test_parquet_sorting_column python/pyarrow/tests/test_dataset.py::test_filesystem_dataset python/pyarrow/tests/test_array.py::test_dictionary_from_buffers .... [100%] 4 passed ``` </details> ### Are there any user-facing changes? Yes. Invalid `None` arguments now raise `TypeError` instead of crashing the interpreter. -- 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]
