Message373637
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 |
|
Date |
User |
Action |
Args |
2020-07-14 14:57:16 | kam193 | set | recipients:
+ kam193 |
2020-07-14 14:57:16 | kam193 | set | messageid: <1594738636.27.0.745451783859.issue41295@roundup.psfhosted.org> |
2020-07-14 14:57:16 | kam193 | link | issue41295 messages |
2020-07-14 14:57:15 | kam193 | create | |
|