[Python] Single chunk ChunkedArray doesn't correctly respect copy in __array__method
- 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.
The expectation is that if `copy=True` is passed into the `__array__` method, the returned numpy array should be writable. This is true if the chunked array contains more than one chunk, but if the array contains a single chunk the returned array is not writable.
The below code:
```python
pyarrow.chunked_array([[2, 3]]).__array__(copy=True).flags
```
Returns:
```
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : False
WRITEABLE : False
ALIGNED : True WRITEBACKIFCOPY : False
```
I originally discovered this when `numpy.array(chunked_array)` returned a read-only array.
Environment:
Python: 3.13.0
OS: Linux
PyArrow version: 23.0.1
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.