Skip to content

Not detecting UnboundLocalError #2400

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions