Message392420
https://docs.python.org/dev/c-api/typeobj.html#Py_TPFLAGS_IMMUTABLETYPE says:
"This bit is set for type objects that are immutable: type attributes cannot be set nor deleted."
Is it possible that a metatype (type subtype) overrides tp_setattro and ignores the Py_TPFLAGS_IMMUTABLETYPE flag? Should we suggest that metatypes implemented in C and overridding tp_setattro should take the Py_TPFLAGS_IMMUTABLETYPE flag in account?
When a type overrides tp_setattro, I understand that it's fine since it's only used to set attributes of its instances, not on the type itself.
--
See also bpo-43770 "Rework C types initialization": some types explicitly sets explicitly tp_setattro to PyObject_GenericSetAttr. But it's unrelated since it's used to set attributes of type instances. |
|
Date |
User |
Action |
Args |
2021-04-30 11:28:38 | vstinner | set | recipients:
+ vstinner, gvanrossum, christian.heimes, Mark.Shannon, serhiy.storchaka, Guido.van.Rossum, corona10, pablogsal, shihai1991, erlendaasland, shreyanavigyan |
2021-04-30 11:28:38 | vstinner | set | messageid: <1619782118.43.0.699262595456.issue43908@roundup.psfhosted.org> |
2021-04-30 11:28:38 | vstinner | link | issue43908 messages |
2021-04-30 11:28:38 | vstinner | create | |
|