Skip to content

BUG: Timedelta comparisons with very large pytimedeltas overflowing #51538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 27, 2023

Conversation

jbrockmendel
Copy link
Member

elif op == Py_NE:
return True
elif op == Py_LE or op == Py_LT:
return self.days <= other.days
Copy link
Member

Choose a reason for hiding this comment

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

  1. Shouldn't we use <= or PY_LE and < for Py_LT?
  2. What about the other components?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm i wrote this with self.unit == "ns" in mind, in which case if it overflows we really just need to know which direction it overflowed. but with "s"/"ms" this could be subtly wrong. will update w/ tests.

@mroeschke mroeschke added the Timedelta Timedelta data type label Feb 21, 2023
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Mar 24, 2023
@jbrockmendel
Copy link
Member Author

updated+green

@mroeschke mroeschke removed the Stale label Mar 27, 2023
@mroeschke mroeschke added this to the 2.0 milestone Mar 27, 2023
@mroeschke mroeschke merged commit 125e1ea into pandas-dev:main Mar 27, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Mar 27, 2023
@jbrockmendel jbrockmendel deleted the bug-td-cmp branch March 27, 2023 17:42
mroeschke pushed a commit that referenced this pull request Mar 27, 2023
…ery large pytimedeltas overflowing) (#52241)

Backport PR #51538: BUG: Timedelta comparisons with very large pytimedeltas overflowing

Co-authored-by: jbrockmendel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: comparing pd.Timedelta with timedelta.max fails
2 participants