Skip to content

BUG: Fix issue #66552 - #66568

Open
jas20han-tech wants to merge 1 commit into
pandas-dev:mainfrom
jas20han-tech:fix-issue-66552
Open

BUG: Fix issue #66552#66568
jas20han-tech wants to merge 1 commit into
pandas-dev:mainfrom
jas20han-tech:fix-issue-66552

Conversation

@jas20han-tech

@jas20han-tech jas20han-tech commented Jul 31, 2026

Copy link
Copy Markdown
  • closes BUG: datetimelike arithmetic landing on the NaT sentinel silently returns NaT #66552
  • Tests added and passed if fixing a bug or adding a new feature
    - test_arithmetic_landing_on_nat_sentinel_raises (pandas/tests/scalar/timestamp/test_arithmetic.py)
    - test_td_add_sub_landing_on_nat_sentinel_raises, test_td_mul_div_landing_on_nat_sentinel_raises (pandas/tests/scalar/timedelta/test_arithmetic.py)
    - test_dti_add_dateoffset_landing_on_nat_sentinel_raises (pandas/tests/arithmetic/test_datetime64.py)
    - test_tdi_sub_landing_on_nat_sentinel_raises (pandas/tests/arithmetic/test_timedelta64.py)
    - test_implementation_limits updated (pandas/tests/scalar/timedelta/test_timedelta.py)
    - Verified: all 6 fail on un-fixed source, pass with fix; full gate 21524 passed / 724 skipped / 47 xfailed / 0 failed
  • All code checks passed.
    - pre-commit run --files <15 changed files>: all hooks pass (ruff, isort, cython-lint, vulture, codespell, whatsnew sort, etc.)
  • Added type annotations to new arguments/methods/functions.
    - add_overflowsafe(left, right, raise_on_sentinel: bool = ...) annotated in pandas/_libs/tslibs/np_datetime.pyi; internal Cython cdef helpers (_add_timedelta_overflowsafe) are module-private and need no stubs.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
    - doc/source/whatsnew/v3.1.0.rst (Datetimelike section, line 363, sorted): datetimelike arithmetic landing exactly on the NaT sentinel now raises instead of returning NaT/wrapping (:issue:66552)
  • I have reviewed and followed all the contribution guidelines
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.
    - AI (opencode, model big-pickle) developed the fix and ran the full 9-step validation checklist; pandas AGENTS.md was loaded and followed throughout.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: datetimelike arithmetic landing on the NaT sentinel silently returns NaT

1 participant