Skip to content

changed overload order for date.__sub__ and datetime.__sub__ #10999

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 2 commits into from
Feb 19, 2024

Conversation

randolf-scholz
Copy link
Contributor

Fix for #10924

  • Changed overload order for date.__sub__
  • Changed overload order for datetime.__sub__
  • Removed self: _D, __value: _D in favor of self, __value: Self (testing)

@randolf-scholz randolf-scholz marked this pull request as ready for review November 9, 2023 13:11

This comment has been minimized.

@JelleZijlstra
Copy link
Member

This has significant merge conflicts now.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@randolf-scholz
Copy link
Contributor Author

randolf-scholz commented Feb 19, 2024

@JelleZijlstra I merged main. The patch should also fix the following False-Negative:

https://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=0d0b699d25f8b9b89b0871e32ab6d33e

from datetime import date, datetime as dt

d = date(2024,1,1)
dt.__sub__(d, d)  # raises TypeError at runtime.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit 601587e into python:main Feb 19, 2024
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.

3 participants