Skip to content

mypy gives 'not defined' error for use after global declaration #5732

Open
@onlined

Description

@onlined

In version 0.630 and master (with Python 3.7.0), I get this error :

def foo() -> None:
    global myglobal
    myglobal = 2  # error: Name 'myglobal' is not defined

I thought that I should not get an error. Is this behavior correct?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions