Message392420
| Author |
vstinner |
| Recipients |
Guido.van.Rossum, Mark.Shannon, christian.heimes, corona10, erlendaasland, gvanrossum, pablogsal, serhiy.storchaka, shihai1991, shreyanavigyan, vstinner |
| Date |
2021年04月30日.11:28:38 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1619782118.43.0.699262595456.issue43908@roundup.psfhosted.org> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|