mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163.
This commit is contained in:
parent
d84da1b67a
commit
42dae6a89b
5 changed files with 9 additions and 9 deletions
|
@ -164,7 +164,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
|||
|
||||
if ((l->flags & READONLY) || l->type == T_STRING)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||
PyErr_SetString(PyExc_AttributeError, "readonly attribute");
|
||||
return -1;
|
||||
}
|
||||
if ((l->flags & WRITE_RESTRICTED) && PyEval_GetRestricted()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue