Skip to content

Not detecting UnboundLocalError #2400

Closed
@tlynn

Description

@tlynn

mypy doesn't seem to warn about control flows which might lead to UnboundLocalError, e.g.:

def func(arg):
    if arg:
        variable = 1
    print(variable)

func(0)

Is this deliberate?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions