fboudra opened a new pull request, #51374: URL: https://github.com/apache/arrow/pull/51374
### Rationale for this change https://github.com/apache/arrow/issues/50398 https://github.com/apache/arrow/issues/50829 ### What changes are included in this PR? Finishes the source-level conversion. After this PR every C++ translation unit in src/arrow/python/ compiles under Py_LIMITED_API=0x030B0000, but the PR does not define the flag, so builds and CI are still on the full API. The changes: - common.h: the memoryview path uses PyObject_GetBuffer / PyBuffer_Release instead of PyMemoryView_GET_BUFFER. This also fixes a use-after-free for non-contiguous memoryviews, where the previous ref was dropped without the DECREF. - iterators.h and numpy_convert.cc: PySequence_ITEM and PySequence_Fast_GET_ITEM become PySequence_GetItem and PySequence_Fast plus PyList_GetItem, uniform across GIL-enabled and GIL-disabled builds. - python_to_arrow.cc: PyTuple_GET_SIZE / PyList_GET_SIZE become PyTuple_Size / PyList_Size. - common.cc: the ty->tp_name struct read becomes PyObject_StdStringTypeName. - common.h: PyGILState_Check (full API only, declared in cpython/pystate.h) is replaced with Py_IsInitialized. For any thread that is executing Python code the two mean the same thing, and Py_IsInitialized still catches the post-finalization case that GH-38626 is about. - The vendored pythoncapi_compat.h gets its PyFrame and PyThreadState_GetFrame shims guarded under Py_LIMITED_API; no arrow source calls them. The last commit also fixes the remaining blockers in datetime, extension_type, numpy_to_arrow and python_to_arrow, which the per-TU syntax audit (23 translation units) found. ### Are these changes tested? Yes ### Are there any user-facing changes? No ### Was AI used for this PR? **PR code and description written by:** - [x ] Human - [ ] AI **Reviewed before submission by:** - [ x] Human - [ ] AI - [ ] Not reviewed -- 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]
