Uh oh!
There was an error while loading. Please reload this page.
Fix typings of ExceptionGroup and BaseExceptionGroup - #9230
Conversation
sobolevn
commented
Nov 20, 2022
Ok, pyright has only 10 problems: I will add a version guard later on. |
This comment has been minimized.
This comment has been minimized.
sobolevn
commented
Nov 20, 2022
Looks like we need some other solution for unused |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
| # `BaseExceptionGroup` can work with `Exception`: | ||
| beg2 = BaseExceptionGroup("x", [ValueError()]) | ||
| # FIXME: this is not right, runtime returns `ExceptionGroup` instance instead, |
There was a problem hiding this comment.
Should be doable by overriding __new__ (python/mypy#7188), did you try that?
There was a problem hiding this comment.
We have three cases:
BaseExceptionGroup.__new__can returnBaseExceptionGroupfor_BaseExceptionT_coBaseExceptionGroup.__new__can returnExceptionGroupfor_ExceptionT_coBaseExceptionGroup.__new__can return custom subclass
Either the first two work or the third one. Suggestions are welcome
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have an idea for how to fix the test cases on mypy; I'll get to work on a fix. For flake8: would an alternative fix be to have |
This comment has been minimized.
This comment has been minimized.
sobolevn
commented
Nov 21, 2022
@AlexWaygood, thank you, flake8 idea worked! |
This comment has been minimized.
This comment has been minimized.
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. 🤖🎉 |
AlexWaygood
commented
Nov 21, 2022
Hooray, CI is finally green 🎉 |
sobolevn
commented
Nov 23, 2022
I really hope this is correct now! Ping me in case of any problems. |
There are a lot of things going on in this PR:
Selftype, because of howCimplementation workssplitandsubgrouprequireSelfargument to be in callable, because of howCimplementation worksBaseExceptionGroupto and fromExceptionGroupare supported. But not all of themThis is a very complex PR. I would love to provide any of my help to the reviewers.