Skip to content

No error about __future__ import placed after some statements #14195

Open
@denballakh

Description

@denballakh
print('Hello')
from __future__ import annotations

At runtime i get SyntaxError:

  File "D:\_.py", line 2
    from __future__ import annotations
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: from __future__ imports must occur at the beginning of the file

Expected Behavior

  • invalid syntax error

Actual Behavior

  • no errors

Your Environment

  • mypy 1.0.0+dev.db0beb1014d8367221d47d3b11e2b49e757fa2fa (compiled: no) (almost latest currently)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-runtime-semanticsmypy doesn't model runtime semantics correctly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions