8000 (🐞) `Enum.name` is `Any` in 3.11 / support `enum.property` · Issue #12483 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
(🐞) Enum.name is Any in 3.11 / support enum.property #12483
Closed
@KotlinIsland

Description

@KotlinIsland
from enum import Enum

value: Enum

reveal_type(value)
reveal_type(value.name)
> mypy --python-version 3.10 test.py
test.py:5: note: Revealed type is "enum.Enum"
test.py:6: note: Revealed type is "str"
Success: no issues found in 1 source file

> mypy --python-version 3.11 test.py
test.py:5: note: Revealed type is "enum.Enum"
test.py:6: note: Revealed type is "Any"
Success: no issues found in 1 source file

in 3.11 name is decorated with enum.property which is a subtype of types.DynamicClassAttribute (aka, builtins.property)

from python/typeshed#7564
Related #12220

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0