You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(馃悶) 'warn-unreachable' doesn't reactivate after it is suppressed with a <nothing> statement聽#11437
fromtypingimportNoReturndeffoo() ->NoReturn:
raiseExceptiondefbar() ->NoReturn:
foo()
foo()
print("hi") # no warning
The first call to foo is suppress the unreachable intentionally, (same with the second). But the print("hi) should definitely show an unreachable error.
changed the title [-]warn-unreachable doesn't work when two `NoReturn` functions are called[/-][+](馃悶) 'warn-unreachable' doesn't reactivate after it is suppressed with a `<nothing>` statement[/+]on Mar 21, 2022
Activity
sobolevn commentedon Nov 3, 2021
Looks like this is intentional: https://github.com/python/mypy/blame/5703becbbe9be5006ed0d2d998dd4a793f1aedd0/test-data/unit/check-unreachable-code.test#L905
It can be easily changed, but I am not sure that this won't break a lot of existing code.
Let's try it out.
[-]warn-unreachable doesn't work when two `NoReturn` functions are called[/-][+](馃悶) 'warn-unreachable' doesn't reactivate after it is suppressed with a `<nothing>` statement[/+]KotlinIsland commentedon Mar 21, 2022
topic-reachabilityDetecting unreachable code
erictraut commentedon Aug 12, 2023
It appears that the latest version of mypy (1.5) behaves as expected here, so I think this is safe to close.
ikonst commentedon Aug 12, 2023
Likely fixed by #15386