Skip to content

gh-146236: datetime: Improve comparing datetime objects - #146294

Closed
jepler wants to merge 1 commit into
python:mainfrom
jepler:issue146236
Closed

jepler wants to merge 1 commit into
python:mainfrom
jepler:issue146236

Conversation

@jepler

@jepler jepler commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

Comparing datetime objects with different fold= attributes did not preserve the documented "precedes/follows" semantics of comparisons.

Closes: #146236


📚 Documentation preview 📚: https://cpython-previews--146294.org.readthedocs.build/

Comparing datetime objects with different `fold=` attributes
did not preserve the documented "precedes/follows" semantics
of comparisons.
@jepler

jepler commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

I'll investigate the build failures. They seem to indicate I made an error in refcounting.

@jepler

jepler commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

Aside from the refcounting bug, I now understand that the approach of conversion to timestamp will not work, because e.g., datetime.datetime(1,1,1).timestamp() fails.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datetime: Comparision and subtraction of datetime objects does not account for DST changes

1 participant