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

   ### Rationale for this change
   
   Valid Date32 and Date64 values can fall outside Python's datetime.date 
range. Their scalar str and repr paths currently call as_py() and raise 
OverflowError, even though Arrow can format the values safely.
   
   ### What changes are included in this PR?
   
   Date32Scalar and Date64Scalar now preserve their existing formatting for 
Python-representable dates and fall back to the Arrow C++ scalar representation 
only when conversion raises OverflowError. The as_py() behavior is unchanged.
   
   Boundary regressions cover the minimum and maximum storage values for both 
date types, plus an in-range leap-day case.
   
   ### Are these changes tested?
   
   Yes.
   
   - Rebuilt the PyArrow extension against the matching Arrow C++ source 
revision.
   - python -m pytest python/pyarrow/tests/test_scalars.py -q: 144 passed, 45 
skipped.
   - File-scoped pre-commit hooks passed, including Python format, Python lint, 
and Cython lint.
   
   ### Are there any user-facing changes?
   
   Date32 and Date64 scalars outside Python's calendar range now render as 
<value out of range: ...> instead of raising from str() or repr(). This is not 
a breaking API change.
   
   Closes #38444.
   
   ### AI assistance
   
   This PR was prepared with OpenAI Codex assistance for investigation, 
implementation, and test execution. The change is limited to the date scalar 
formatting paths and their regression tests.
   


-- 
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]

Reply via email to