arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[Python] Repr of Date scalars and arrays error if they are outside range of stdlib datetime.date

Open kkraus14 opened this issue 3 years ago • 1 comments

Describe the bug, including details regarding any error messages, version, and platform.

Similar to https://github.com/apache/arrow/issues/36323

Repro:

import pyarrow as pa
import numpy as np

int32_max = np.iinfo('int32').max
int32_min = np.iinfo('int32').min

print(pa.scalar(int32_max, pa.date32()))  # Throws
print(pa.scalar(int32_min, pa.data32()))  # Throws
print(pa.array([int32_min, int32_max], pa.date32()))  # has error message in repr but doesn't throw, output below
[
  <value out of range: -2147483648>,
  <value out of range: 2147483647>
]

Component(s)

Python

kkraus14 avatar Oct 24 '23 20:10 kkraus14

I’m working on a focused fix that keeps as_py() unchanged and falls back to Arrow’s scalar formatting for str()/repr() only when a valid date is outside Python’s calendar range. I’ll include Date32 and Date64 boundary regressions and disclose AI assistance in the PR.

emecii avatar Sep 10 '26 16:09 emecii