Fix Upstream CI NaT issues#11340
Open
ianhi wants to merge 2 commits into
Open
Conversation
numpy >= 2.5 deprecates the 'generic' (unitless) datetime64/timedelta64
dtype. Constructing np.datetime64("2000") or np.datetime64("NaT") in the
parametrize list ran during pytest collection, and with
filterwarnings=error the resulting DeprecationWarning aborted collection
of the whole module on the upstream-dev CI. That in turn produced a
malformed pytest report and silently disabled the
issue-from-pytest-log-action auto-issue filer.
Pin the unit explicitly so collection stays clean on numpy nightly.
numpy >= 2.5 (numpy/numpy#31378, merged 2026-05-11) turns int64.min * timedelta64 from a silent NaT into a hard OverflowError. The CF time decode path relied on the silent NaT and now raises through _check_date_for_units_since_refdate and _check_timedelta_range, surfacing as `ValueError: unable to decode time units '...'` from decode_cf. Detect the sentinel (and float NaN) up front so the multiplication path only sees real numeric inputs. Regression coverage already exists via the existing int64.min parametrizations of test_cf_timedelta and test_roundtrip_timedelta64_nanosecond_precision.
dcherian
reviewed
May 15, 2026
| np.datetime64("2001"), | ||
| np.datetime64("2002"), | ||
| np.datetime64("NaT"), | ||
| np.datetime64("2000", "ns"), |
Contributor
There was a problem hiding this comment.
surprised this wasn't required earlier (unless that numpy change hasn't been released)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two separate things:
I ended up consolidating the two methods in code/times by a bit to avoid writing the same fix twice. They had almost exactly the same code path.
cc @dcherian
Checklist
whats-new.rstapi.rstAI Disclosure