| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
👋 @KotlinIsland and @sobolevn (re: #11361) |
Sorry, something went wrong.
|
Thinking about it more, it's strange that we avoid type checking those blocks. Having --warn-unreachable isn't much helper since (a) it's not enabled by default, and (b) even if it was, it doesn't allude to type-checking being suppressed. In this PR I'm making function and global level consistent, but how can we know it's the consistency we want? (From quickly testing in pyright, it narrows the expression to Never but does not suppress type checking.) |
Sorry, something went wrong.
It's enabled by default in basedmypy. I'm sorry, I'm struggling a little to see all the differences in behavior made here. You are stating that it fixes #12409, but the output is identical. The only difference I could find is your example in the OP, although within a function, which now matches the behavior observed in master for module level. I think that is a great change. |
Sorry, something went wrong.
|
@KotlinIsland Sorry, you are right. I was looking for pre-existing issues and mistook #12409 to be it :) Removing the link. |
Sorry, something went wrong.
Not disagreeing with that, mind you. Rather, questioning why it should suppress type-checking: IMO that's unexpected and comes with no warning. Even if the branch is truly unreachable, suppressing all type checks until you fix reachability effectively makes it a 'blocking error', which we are trying not to have (judging by other 'blocking error' issues). |
Sorry, something went wrong.
| try: | ||
| # try accessing those globals that were never properly initialized | ||
| import native | ||
| native.test() |
There was a problem hiding this comment.
I don't think native.test() is effective in this test.
The first import native fails, and so the second import native also gets executed, and also fails, and we never reach native.test().
Sorry, something went wrong.
There was a problem hiding this comment.
This looks good to me!
We could explore doing things the other way round and see what the mypy_primer fallout looks like. But I'm not super optimistic, I think currently this papers over some bugs in the binder
Sorry, something went wrong.
|
I think it's a good idea to explore changes to this behavior, as it's not very intuitive. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.