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
TypedDict as default_factory in dataclasses is not inferred correctly #5723
Are you reporting a bug, or opening a feature request? bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
changed the title [-]TypedDict as default_factory in dataclasses are not inferred correctly[/-][+]TypedDict as default_factory in dataclasses is not inferred correctly[/+]on Oct 3, 2018
This is actually not specific to dataclasses. It looks like typed dict class objects are never analyzed properly. There is a hack in visit_call_expr in type checker, that checks them specially, but if they appear in any other context, the corresponding CallableType is not created correctly.
Activity
[-]TypedDict as default_factory in dataclasses are not inferred correctly[/-][+]TypedDict as default_factory in dataclasses is not inferred correctly[/+]ilevkivskyi commentedon Oct 3, 2018
This is actually not specific to dataclasses. It looks like typed dict class objects are never analyzed properly. There is a hack in
visit_call_exprin type checker, that checks them specially, but if they appear in any other context, the correspondingCallableTypeis not created correctly.tsangwpx commentedon Nov 4, 2023
In mypy 1.6.1, the output is
workaround:
Refactor/unify access to static attributes (python#19254)