and this works as expected with dataclasses on mypy and pyright, but it doesn't currently work on pyre because pyre doesn't know yet that dataclasses have the __dataclass_fields__ classvar. (I haven't checked other type checkers.)
At runtime, is_dataclass really only checks for the __dataclass_fields__ attribute:
thomkeh commentedDec 9, 2022
•
edited
@AlexWaygood proposed the following stubs in this comment: python/mypy#14263 (comment)
and this works as expected with dataclasses on mypy and pyright, but it doesn't currently work on pyre because pyre doesn't know yet that dataclasses have the
__dataclass_fields__classvar. (I haven't checked other type checkers.)At runtime,
is_dataclassreally only checks for the__dataclass_fields__attribute:https://github.com/python/cpython/blob/7a0f3c1d92ef0768e082ace19d970b0ef12e7346/Lib/dataclasses.py#L1263-L1267
However, it also works with types in addition to instances, so an overload would be needed.
See also this issue for context: python/mypy#14215
The text was updated successfully, but these errors were encountered: