You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromenumimportEnum, StrEnumclassTag(Enum):
passclassStrTag(StrEnum):
passreveal_type(set(Tag)) # note: Revealed type is "builtins.set[__main__.Tag]"reveal_type(set(StrTag)) # note: Revealed type is "builtins.set[builtins.str]"
This happens because str is also Iterable and str is closer in the MRO than Enum. Adding def __iter__(self) -> Self: ... to StrEnum solves the issue. But, I am not sure that this is the correct / full fix.
Bug Report
mypy types a set of
StrEnum
asset[str]
.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.13&gist=237de7c0610830acd5a5104d18541e3e
Expected Behavior
mypy should type
set(StrTag)
asset[StrTag]
, notset[str]
.Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: