Author Johan Hidding
Recipients Johan Hidding
Date 2019-08-15.12:02:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565870535.54.0.93577990924.issue37868@roundup.psfhosted.org>
In-reply-to
Content
Given a class `A` that overloads `__getattr__`

```
class A:
  def __getattr__(self, key):
    return 0
```

An instance of this class is always identified as a dataclass.

```
from dataclasses import is_dataclass

a = A()
print(is_dataclass(a))
```

gives the output `True`.

Possible fix: check for the instance type.

```
is_dataclass(type(a))
```

does give the correct answer.
History
Date User Action Args
2019-08-15 12:02:15Johan Hiddingsetrecipients: + Johan Hidding
2019-08-15 12:02:15Johan Hiddingsetmessageid: <1565870535.54.0.93577990924.issue37868@roundup.psfhosted.org>
2019-08-15 12:02:15Johan Hiddinglinkissue37868 messages
2019-08-15 12:02:15Johan Hiddingcreate