Closed
Description
from enum import StrEnum, auto
from typing import reveal_type
class Test(StrEnum):
test = auto()
print(type(Test.test.value))
def func(x: Test):
print(reveal_type(x.value))
func(Test.test)
On 3.11
this returns:
❯ python test.py
<class 'str'>
Runtime type is 'str'
test
However, both pyright
and mypy
reveal the type as being int
because of:
Lines 289 to 290 in 201940c
This was introduced all the way back in #1331.
Well it might be "mostly" correct, with StrEnum
this is clearly false and leads to cases where we couldn't use StrEnum
without adding type: ignores
anyway.
I don't really know what the appropriate fix is so I sadly can't contribute one.