Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Do not emit unreachable warnings for lines that returnNotImplemented.#20083
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Do not emit unreachable warnings for lines that returnNotImplemented.#20083
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Diff frommypy_primer, showing the effect of this PR on open source code: yarl (https://github.com/aio-libs/yarl)+ yarl/_url.py:550: error: Unused "type: ignore" comment [unused-ignore] |
A5rocks left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this makes sense to me, even if it complicates the general idea of what exactly is exempt from unreachability warnings. (I guess now it's "anyway to bail out is OK"?)
I can also see this being unnecessary :^). Given nobody has complained, I'm not sure we really need to add this as a feature (since that's ultimately what this is).
sterliakov left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this is a good idea. See#363 (yes, three-digit issue number!) - this removes anunreachable warning from the "should be fine" snippet there. I guess it has never been explicitly reported only because--warn-unreachable is hidden too well, many users aren't even aware that it exists.
tyralla commentedOct 19, 2025
Wow, I overlooked this dinosaur. That's a nice tool you have! Interpreting classA1:x=1def__add__(self,o:A1)->float:ifisinstance(o,A1):returnself.x+o.xreturnNotImplementedclassA2:x=2def__add__(self,o:A2)->float:returnself.x+o.xclassB:y=3def__radd__(self,o:A1|A2)->float:returnself.y+o.xA1()+B()# worksA2()+B()# fails (undetected by Mypy) I will try to find a fix for this as soon as I have some spare time.
Yes, I agree. As soon as
It would say it is more of a fix than a feature, because |
tyralla commentedOct 19, 2025
Thanks for the reviews! |
c2a82b9 intopython:masterUh oh!
There was an error while loading.Please reload this page.
I think no one has complained so far. I just encountered this (in my understanding) lack in
TypeChecker.is_noop_for_reachabilityworking on#20068.