public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-xarray] rawhide: Fix OverflowError under NumPy 2.0+ when multiplying np.iinfo(int64).min with timedelta64
@ 2026-08-01 18:39 Filipe Rosset
  0 siblings, 0 replies; only message in thread
From: Filipe Rosset @ 2026-08-01 18:39 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-xarray
            Branch : rawhide
            Commit : dd3b5db0b1cc6caac521c20eb6a445010383820b
            Author : Filipe Rosset <rosset.filipe@gmail.com>
            Date   : 2026-07-28T18:15:58-03:00
            Stats  : +24/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-xarray/c/dd3b5db0b1cc6caac521c20eb6a445010383820b?branch=rawhide

            Log:
            Fix OverflowError under NumPy 2.0+ when multiplying np.iinfo(int64).min with timedelta64

Resolves: rhbz#2504597

---
diff --git a/0003-xarray-numpy2-overflow.patch b/0003-xarray-numpy2-overflow.patch
new file mode 100644
index 0000000..2969d0c
--- /dev/null
+++ b/0003-xarray-numpy2-overflow.patch
@@ -0,0 +1,22 @@
+Fix OverflowError under NumPy 2.0+ when multiplying np.iinfo(int64).min with timedelta64
+
+--- a/xarray/coding/times.py
++++ b/xarray/coding/times.py
+@@ -390,6 +390,8 @@
+     date, unit: NPDatetimeUnitOptions, ref_date: pd.Timestamp
+ ) -> pd.Timestamp:
+     # check for out-of-bounds floats and raise
++    if date == np.iinfo("int64").min:
++        return pd.Timestamp("NaT")
+     if date > np.iinfo("int64").max or date < np.iinfo("int64").min:
+         raise OutOfBoundsTimedelta(
+             f"Value {date} can't be represented as Datetime/Timedelta."
+@@ -411,6 +413,8 @@
+ 
+ 
+ def _check_timedelta_range(value, data_unit, time_unit):
++    if value == np.iinfo("int64").min:
++        return
+     if value > np.iinfo("int64").max or value < np.iinfo("int64").min:
+         OutOfBoundsTimedelta(f"Value {value} can't be represented as Timedelta.")
+     # on windows multiplying nan leads to RuntimeWarning

diff --git a/python-xarray.spec b/python-xarray.spec
index 407d936..c4cd7dd 100644
--- a/python-xarray.spec
+++ b/python-xarray.spec
@@ -19,6 +19,8 @@ Source:         %pypi_source %{srcname}
 Patch:          0001-Drop-pydap-from-dependencies.patch
 # Fix failures with latest dependencies.
 Patch:          https://github.com/pydata/xarray/pull/11204.patch
+# Fix OverflowError under NumPy 2.0+ when date is np.iinfo(int64).min
+Patch:          0003-xarray-numpy2-overflow.patch
 
 BuildArch:      noarch
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-01 18:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-01 18:39 [rpms/python-xarray] rawhide: Fix OverflowError under NumPy 2.0+ when multiplying np.iinfo(int64).min with timedelta64 Filipe Rosset

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox