Author kam193
Recipients kam193
Date 2020-07-14.14:57:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594738636.27.0.745451783859.issue41295@roundup.psfhosted.org>
In-reply-to
Content
CPython 3.8.4 broke previously correct custom __setattr__ implementation, when metaclass inheritances from multiple classes, including not-meta.

Following code:

```
class Meta(type):
    def __setattr__(cls, key, value):
        type.__setattr__(cls, key, value)

class OtherClass:
    pass


class DefaultMeta(OtherClass, Meta):
    pass

obj = DefaultMeta('A', (object,), {})
obj.test = True
print(obj.test)
```

Works in Python up to 3.8.3, but in 3.8.4 it raises:

Traceback (most recent call last):
  File "repr.py", line 13, in <module>
    obj.test = True
  File "repr.py", line 3, in __setattr__
    type.__setattr__(cls, key, value)
TypeError: can't apply this __setattr__ to DefaultMeta object

This change affects e.g. https://github.com/pallets/flask-sqlalchemy/issues/852
History
Date User Action Args
2020-07-14 14:57:16kam193setrecipients: + kam193
2020-07-14 14:57:16kam193setmessageid: <1594738636.27.0.745451783859.issue41295@roundup.psfhosted.org>
2020-07-14 14:57:16kam193linkissue41295 messages
2020-07-14 14:57:15kam193create