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
is_dataclass(Any) return type incorrect, differs from is_dataclass(object) #12401
I don't think there is a fix, as Any is compatible with everything, so it will always match the first overload. Reordering is also not possible, at least not until we get a "Not" type (python/typing#801).
As a hack, we could add another overload case, with argument type that no real type ever satisfies but only Any can satisfy. Could we use the Never type?
Activity
srittau commentedon Jul 22, 2024
I don't think there is a fix, as
Anyis compatible with everything, so it will always match the first overload. Reordering is also not possible, at least not until we get a "Not" type (python/typing#801).intgr commentedon Jul 22, 2024
As a hack, we could add another overload case, with argument type that no real type ever satisfies but only
Anycan satisfy. Could we use theNevertype?sobolevn commentedon Jul 27, 2024
Refs python/mypy#17579
max-muoto commentedon Aug 6, 2024
For reference Pyright is handling this just fine: https://pyright-play.net/?pyrightVersion=1.1.374&pythonVersion=3.14&strict=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCCKcAUKJFACYCGM1AxgDbUDOLApi5trvkiwH0adJqxYkJldsCjsAHtWyN2ARgAU1EGgBchYgEooAWgB8UAHJgU7bSSj3MM-kNoNmbDVv22HvqCHYAN3ZqRgF4BHZPNEMoCRIpGXlFBGUAJmjdMAAjACt2ehhDUwsrGzsHJCdBYTcxaO8Kv38gkLCIqKbmh000Lt9DEiA
srittau commentedon Aug 7, 2024
@intgr We could try your suggestion in an experimental PR. (We should definitely add tests, though.) Otherwise I would close this issue as unfixable.
intgr commentedon Aug 12, 2024
Opened PR:
is_dataclass(Any)#12517sobolevn commentedon Aug 14, 2024
MyPy PR is here: python/mypy#17678