Closed
Description
Describe the bug
if there is a return
statement in a with contextlib.suppress(Exception)
block, then all the code after is grayed out as unreachable.
To Reproduce
See the code example below
Expected behavior
Code after a return
in a contextlib.suppress
is not marked as unreachable.
Screenshots or Code
import contextlib
from typing import NoReturn
def func() -> int:
with contextlib.suppress(KeyError):
return func2()
return 5 # this line is grayed out
def func2() -> NoReturn:
raise KeyError
VS Code extension or command-line
pyright vscode extension version 1.1.45