mypy icon indicating copy to clipboard operation
mypy copied to clipboard

(🐞) False `except` contains `Any` when inside a function that references a variable that is defined after the function and has an inferred type

Open KotlinIsland opened this issue 3 years ago • 1 comments

def f():
    a
    try:
        pass
    except Exception as ex:  # error: Expression has type "Any"  [misc]
        pass


a = 1 + 1

playground

KotlinIsland avatar Jul 17 '22 23:07 KotlinIsland

Related to #8900

KotlinIsland avatar Aug 11 '22 13:08 KotlinIsland