New submission from kam193 <[email protected]>:
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
----------
messages: 373637
nosy: kam193
priority: normal
severity: normal
status: open
title: CPython 3.8.4 regression on __setattr__ in multiinheritance with
metaclasses
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com