-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
python-dateutil: respect inheritance on relativedelta.__rsub__ (#11462) #11463
python-dateutil: respect inheritance on relativedelta.__rsub__ (#11462) #11463
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Please ignore my comments about class datetime(date):
# ...
@overload # type: ignore[override]
def __sub__(self, __value: Self) -> timedelta: ...
@overload
def __sub__(self, __value: timedelta) -> Self: ... |
Oddly enough, I wasn't able to reproduce the issue locally using pyright==1.1.342 yet. edit: just saw your newly added comment. |
I'm not sure what's going on. Maybe @erictraut has an idea as it seems that only pyright fails while mypy accepts the tests. |
I'm not able to repro this issue with the latest version of pyright (1.1.351). To try to repro, I manually applied the change in I also tried to repro it with 1.1.342, which is the version of pyright that typeshed is currently pinned to. So I'm not sure what's happening here. |
This comment has been minimized.
This comment has been minimized.
@srittau anything I can do to push this forward? The failures persist with the re-run. It almost seems like the test is running without the updated stubs? That was exactly the case I'm trying to fix in this MR. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm still stumped what the problem here is. I have the same results as @erictraut when testing this PR locally. It really behaves as if the changes to the python-dateutil stubs were ignored. |
This reverts commit e003e9e.
Here's what I'm going to do: Comment out the offending line in the test cases and merge this PR if the tests pass. Then I'm going to open another PR restoring the line in the tests. If these pass, it will confirm the suspicion that the current stubs are not picked up. |
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Support inheritance for
relativedelta.__rsub__
by setting theTypeVar
upper bound todatetime.date
(parent ofdatetime.datetime
), instead of having both those as constraint.Resolved #11462