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:
Collin Winter 2007-03-28 21:44:53 +00:00
parent d84da1b67a
commit 42dae6a89b
5 changed files with 9 additions and 9 deletions

View file

@ -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()) {