diff options
author | Collin Winter <collinw@gmail.com> | 2007-03-28 21:44:53 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-03-28 21:44:53 (GMT) |
commit | 42dae6a89bd24073ae1b66599180cc94f15ff232 (patch) | |
tree | 7df2ee86dc68b54e0b207eaa6862bfc82272e382 /Python/structmember.c | |
parent | d84da1b67a12df114de2f76e0644174f07f2c834 (diff) | |
download | cpython-42dae6a89bd24073ae1b66599180cc94f15ff232.zip cpython-42dae6a89bd24073ae1b66599180cc94f15ff232.tar.gz cpython-42dae6a89bd24073ae1b66599180cc94f15ff232.tar.bz2 |
Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163.
Diffstat (limited to 'Python/structmember.c')
-rw-r--r-- | Python/structmember.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/structmember.c b/Python/structmember.c index 2bb6e4e..87c1641 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -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()) { |