Skip to content

no error when reassigning to Final name after conditional assignment #2674

@KotlinIsland

Description

@KotlinIsland
from typing import Final

def f() -> bool:
    return bool()

ABC: Final

if f():
    ABC = 1

ABC = 2  # no error

playground

also when assigned in function

from typing import Final
ABC: Final


def f():
    ABC = 1    # no error

also when not assigned at all

from typing import Final
ABC: Final   # no error

Version

1227dd672

Metadata

Metadata

Assignees

Labels

typing semanticstyping-module features, spec compliance, etc

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions