This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Johan Hidding, eric.smith, serhiy.storchaka
Date 2019-08-15.20:04:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565899471.97.0.464982769005.issue37868@roundup.psfhosted.org>
In-reply-to
Content
I am not sure that it is good idea to accept a type and an instance, but if it is a goal, is_dataclass() should be defined as:

def is_dataclass(obj):
    cls = obj if isinstance(obj, type) else type(obj)
    return hasattr(cls, _FIELDS)

_is_dataclass_instance() should be changed too:

def _is_dataclass_instance(obj):
    return hasattr(type(obj), _FIELDS)
History
Date User Action Args
2019-08-15 20:04:32serhiy.storchakasetrecipients: + serhiy.storchaka, eric.smith, Johan Hidding
2019-08-15 20:04:31serhiy.storchakasetmessageid: <1565899471.97.0.464982769005.issue37868@roundup.psfhosted.org>
2019-08-15 20:04:31serhiy.storchakalinkissue37868 messages
2019-08-15 20:04:31serhiy.storchakacreate