Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163.
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 @@
 
 	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()) {