kjgilder opened a new pull request, #46003:
URL: https://github.com/apache/arrow/pull/46003

   ### Rationale for this change
   This PR fixes a behavioral inconsistency when creating arrays using 
`pa.array(..., safe=False)` with values that exceed the exact representable 
range of the target type. Previously, this would raise an error, even though 
the `safe=False` flag should have allowed lossy rounding—just like 
`Array.cast(..., safe=False)` does.
   
   Closes #45875 
   
   ### What changes are included in this PR?
   This patch modifies the `array()` function so that the `safe` argument is 
properly propagated through the internal `_sequence_to_array()` conversion 
logic. Now, both direct array creation and casting behave consistently when 
`safe=False` is passed.
   
   ### Are these changes tested?
   The change has been manually tested in a development build of PyArrow to 
confirm that:
   ```python
   pa.array([99999999]).cast(pa.float32(), safe=False)       # Works
   pa.array([99999999], pa.float32(), safe=False)            # Now also works 
(previously errored)
   
   ### Are there any user-facing changes?
   Yes — this bugfix allows pa.array(..., safe=False) to behave consistently 
with .cast(..., safe=False) in lossy float conversions. This fixes unexpected 
errors and better aligns with the documented behavior of the safe parameter.


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to