diff Python/structmember.c @ 41317:b897b77a004f

Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163.
author Collin Winter <collinw@gmail.com>
date Wed, 28 Mar 2007 21:44:53 +0000
parents cc992d75d5b3
children f60c877d52c8
line wrap: on
line diff
--- a/Python/structmember.c	Wed Mar 28 21:03:48 2007 +0000
+++ b/Python/structmember.c	Wed Mar 28 21:44:53 2007 +0000
@@ -164,7 +164,7 @@
 
 	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()) {