From f752a8559959733f2224e92c8a86b512278371f9 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 27 Feb 2022 06:41:42 +0100 Subject: update seq_try_except_finally puzzle --- issues.toml | 3 +++ 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 = 'issue 790' + +[pyright] +seq_try_except_finally = 'issue 2930' 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 -- cgit v1.2.3