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
Generate an error if trying to use @final with TypedDict #7849
@final doesn't work as expected with TypedDicts, but mypy doesn't complain about it:
fromtyping_extensionsimportfinal, TypedDict@final# No error hereclassC(TypedDict):
x: floaty: intz: strclassD(C): # No error herepass
This is confusing, since users would expect that @final prevents structural subtyping, but that's not the case. The simplest fix would be to generate an error if @final is used in a TypedDict definition.
Hints: This should be a pretty simple thing to fix. Look at what happens in analyze_class in mypy/semanal.py.
Activity
TH3CHARLie commentedon Nov 4, 2019
@JukkaL I have submitted a PR #7865 , please take a look
Generate an error if trying to use @Final with TypedDict (#7865)