Skip to content

3.14 deferred evaluation of annotations #15100

Closed
@nickdrozd

Description

@nickdrozd

In 3.14, type annotations are not evaluated eagerly.

https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-pep649

So this snippet runs fine:

class X:
    x: X

Ruff flags the field annotation as an undefined name. It is undefined in 3.13 and earlier, but in 3.14 this is a false positive. Earlier versions require from __future__ import annotations to make this work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    python314Related to Python 3.14ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions