Skip to content

Fix Upstream CI NaT issues#11340

Open
ianhi wants to merge 2 commits into
pydata:mainfrom
ianhi:ian/upstream-ci
Open

Fix Upstream CI NaT issues#11340
ianhi wants to merge 2 commits into
pydata:mainfrom
ianhi:ian/upstream-ci

Conversation

@ianhi
Copy link
Copy Markdown
Collaborator

@ianhi ianhi commented May 15, 2026

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

  • [NA] Closes #xxxx
  • [NA] Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [NA] New functions/methods are listed in api.rst

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR. Tools: {e.g., Claude, Codex, GitHub Copilot, ChatGPT, etc.}

ianhi added 2 commits May 15, 2026 11:29
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.
np.datetime64("2001"),
np.datetime64("2002"),
np.datetime64("NaT"),
np.datetime64("2000", "ns"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised this wasn't required earlier (unless that numpy change hasn't been released)

Copy link
Copy Markdown
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants