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
In code which is checking if a field has a default, a check to see if Field.default_factory is MISSING will be misreported as a comparison-overlap error if mypy --strict is used.
This looks like a bug in the typeshed stub dataclasses.pyi. The type annotations for Field.default and Field.default_factory should probably be unions that include the type _MISSING_TYPE.
Good point! I didn't think to look at typeshed -- I thought mypy was doing something weird.
I'll put in a PR to update it. Assuming that's right and my patch is accepted, I'll close this when that's merged.
Bug Report
In code which is checking if a field has a default, a check to see if
Field.default_factory is MISSING
will be misreported as a comparison-overlap error ifmypy --strict
is used.To Reproduce
In
foo.py
:Expected Behavior
This check should pass. One of the valid values for
default_factory
isMISSING
.Actual Behavior
With the above reproduction,
Your Environment
0.931
andmaster
(0.940+dev.84b977876aa76bfebf5fe49d11ebd202e4a60a33
)--strict
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: