diff options
-rw-r--r-- | issues.toml | 3 | ||||
-rw-r--r-- | puzzles/seq_try_except_finally.py | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/issues.toml b/issues.toml index 81cd3d4..1740287 100644 --- a/issues.toml +++ b/issues.toml @@ -4,3 +4,6 @@ typing_typevar_constrained = '<a href="https://github.com/python/mypy/issues/118 [pytype] typing_literal_enum_name = '<a href="https://github.com/google/pytype/issues/790">issue 790</a>' + +[pyright] +seq_try_except_finally = '<a href="https://github.com/microsoft/pyright/issues/2930">issue 2930</a>' diff --git a/puzzles/seq_try_except_finally.py b/puzzles/seq_try_except_finally.py index d63ab10..ea17a16 100644 --- a/puzzles/seq_try_except_finally.py +++ b/puzzles/seq_try_except_finally.py @@ -1,8 +1,11 @@ -def foo() -> None: +def f() -> None: file = None try: file = open('test.json') except Exception: return None finally: - file.name # error + if file: + file.close() + + file.name |