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
{{ message }}
Repository navigation
1.5.0 regression: register enum member typed as callable #15870
@svalentin FYI — this is another small typeshed tweak that fixes a regression in mypy 1.5.0 — it could possibly be worth cherry-picking to a 1.5 patch release if the PyPI overlords ever let us make another mypy release :-)
Having said that, idk how many people are defining enums with a register member — it seems unlikely to me that too many people will be hitting this regression!
We should be starting 1.6 really soon since 1.5 was delayed quite a bit and there's already quite a number of changes to pick up. So it's probably best to just wait for 1.6.
If we want to pick this up for 1.5, we would need 1.5.2 as 1.5.1 is "cut" and just waiting for PyPI gods. (1.5 ended up being such an odd release)
Having said that, idk how many people are defining enums with a register member — it seems unlikely to me that too many people will be hitting this regression!
Agreed, especially given that it's recommended to useALL_CAPS for enum members. I hit this by pure chance, by not following that convention for historical reasons, and by having a KeyMode.register (as in vim registers) enum member. 😅
Does anybody here know how Mypy resolves the metaclass conflict (in typeshed) for StrEnum?
StrEnum bases are:
str -> Sequence -> Collection -> Protocol, where Protocol is an ABCMeta
ReprEnum -> Enum, which is an EnumMeta
So AFAIK there's this conflict, which normally would raise Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases. However Mypy seems to stay silent on this one.
Activity
Ignore mypy regression
AlexWaygood commentedon Aug 14, 2023
Fixed in python/typeshed#10577.
@svalentin FYI — this is another small typeshed tweak that fixes a regression in mypy 1.5.0 — it could possibly be worth cherry-picking to a 1.5 patch release if the PyPI overlords ever let us make another mypy release :-)
Having said that, idk how many people are defining enums with a
registermember — it seems unlikely to me that too many people will be hitting this regression!svalentin commentedon Aug 14, 2023
We should be starting 1.6 really soon since 1.5 was delayed quite a bit and there's already quite a number of changes to pick up. So it's probably best to just wait for 1.6.
If we want to pick this up for 1.5, we would need 1.5.2 as 1.5.1 is "cut" and just waiting for PyPI gods. (1.5 ended up being such an odd release)
The-Compiler commentedon Aug 15, 2023
Thanks for the quick fix!
Agreed, especially given that it's recommended to use
ALL_CAPSfor enum members. I hit this by pure chance, by not following that convention for historical reasons, and by having aKeyMode.register(as in vim registers) enum member. 😅davidhalter commentedon Aug 16, 2023
Does anybody here know how Mypy resolves the metaclass conflict (in typeshed) for
StrEnum?StrEnumbases are:So AFAIK there's this conflict, which normally would raise
Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases. However Mypy seems to stay silent on this one.