| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| exs3 = (E2, E3) | ||
| try: pass | ||
| except exs3 as e3: | ||
| reveal_type(e3) # E: Revealed type is '__main__.E1' |
There was a problem hiding this comment.
Huh, this is puzzling -- do you understand why it ends up being E1?
Sorry, something went wrong.
There was a problem hiding this comment.
E1 is the nearest common ancestor to E2 and E3, so it is the most specific type that generalizes both.
Sorry, something went wrong.
| self.fail('Unsupported exception', n) | ||
| return AnyType() | ||
|
|
||
| def check_for_function_like_exception_type(self, type: Type, context: Context) -> Type: |
There was a problem hiding this comment.
Because this can return None and not only an actual Type, let's annotate as Optional[Type]. PEP 484 specifies that types don't implicitly contain None; we don't quite yet implement that properly in mypy, so we don't catch this, but there's an active PR for it (#1562) and we will soon.
Sorry, something went wrong.
|
Thanks @pdmccormick for the fix! I also appreciate the negative diffstat on application code, and the positive diffstat on test code. :-) |
Sorry, something went wrong.
Follow-up to new handling from python#1610.
| Back | FazBrowse Home | New Git URL |
Fixes issue #1590.