def foo() -> None: file = None try: file = open('test.json') except Exception: return None finally: file.name # error