From d7220a8efe0730b7e05d7078a478a5b3db443b5b Mon Sep 17 00:00:00 2001 From: Asthenia0412 Date: Wed, 14 Oct 2026 09:08:59 +0000 Subject: [PATCH] GH-53519: [Python] Fix StringArray/LargeStringArray.from_buffers to accept int64 arguments The StringArray.from_buffers() and LargeStringArray.from_buffers() methods declared their length, null_count and offset parameters as C int (32-bit), but the underlying C++ ArrayData counters are int64_t. This caused OverflowError when passing values above INT32_MAX. Widen all three parameters to int64_t in both methods so that the specialized factories accept the same valid arrays as the generic Array.from_buffers() does. Closes #53519 --- python/pyarrow/array.pxi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index bf9a6d67228..27f93c27cbc 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -4203,9 +4203,9 @@ cdef class StringArray(Array): return cp.PyUnicode_DecodeUTF8(view.data(), view.size(), NULL) @staticmethod - def from_buffers(int length, Buffer value_offsets, Buffer data, - Buffer null_bitmap=None, int null_count=-1, - int offset=0): + def from_buffers(int64_t length, Buffer value_offsets, Buffer data, + Buffer null_bitmap=None, int64_t null_count=-1, + int64_t offset=0): """ Construct a StringArray from value_offsets and data buffers. If there are nulls in the data, also a null_bitmap and the matching @@ -4241,9 +4241,9 @@ cdef class LargeStringArray(Array): return cp.PyUnicode_DecodeUTF8(view.data(), view.size(), NULL) @staticmethod - def from_buffers(int length, Buffer value_offsets, Buffer data, - Buffer null_bitmap=None, int null_count=-1, - int offset=0): + def from_buffers(int64_t length, Buffer value_offsets, Buffer data, + Buffer null_bitmap=None, int64_t null_count=-1, + int64_t offset=0): """ Construct a LargeStringArray from value_offsets and data buffers. If there are nulls in the data, also a null_bitmap and the matching