Unreachable code detection based on Exception inheritance #2595
kumaraditya303
started this conversation in
Ideas
Replies: 2 comments
-
Thanks for the suggestion. I agree this pattern could be indicative of a bug. It could also be a harmless extra piece of code that was left in place. Let's see if other pyright users want to see a check for this condition. Please upvote the suggestion if you do. |
Beta Was this translation helpful? Give feedback.
0 replies
-
For reference Python builtin exception tree https://docs.python.org/3/library/exceptions.html#exception-hierarchy |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Take this code as an example:
In this example the FooBar will never be reachable as FooBar is a subclass of Foo and Foo already catches exception.
Pyright can flag this as unreachable.
Beta Was this translation helpful? Give feedback.
All reactions