classobject.c moduleobject.c stdwinmodule.c xxobject.c:
raise AttributeError, not KeyError, when attribute deletion fails.
sunaudiodevmodule.c: check for deletion before calling setmember.
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index e33610d..8b3812b 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -1051,8 +1051,13 @@
 		if (tp->t_attr == NULL)
 			return -1;
 	}
-	if (v == NULL)
-		return dictremove(tp->t_attr, name);
+	if (v == NULL) {
+		int rv = dictremove(tp->t_attr, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+			        "delete non-existing text object attribute");
+		return rv;
+	}
 	else
 		return dictinsert(tp->t_attr, name, v);
 }
@@ -1253,8 +1258,13 @@
 		if (mp->m_attr == NULL)
 			return -1;
 	}
-	if (v == NULL)
-		return dictremove(mp->m_attr, name);
+	if (v == NULL) {
+		int rv = dictremove(mp->m_attr, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+			        "delete non-existing menu object attribute");
+		return rv;
+	}
 	else
 		return dictinsert(mp->m_attr, name, v);
 }
@@ -1655,8 +1665,13 @@
 		if (wp->w_attr == NULL)
 			return -1;
 	}
-	if (v == NULL)
-		return dictremove(wp->w_attr, name);
+	if (v == NULL) {
+		int rv = dictremove(wp->w_attr, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+			        "delete non-existing menu object attribute");
+		return rv;
+	}
 	else
 		return dictinsert(wp->w_attr, name, v);
 }
diff --git a/Modules/sunaudiodev.c b/Modules/sunaudiodev.c
index 0cf5613..d02041a 100644
--- a/Modules/sunaudiodev.c
+++ b/Modules/sunaudiodev.c
@@ -343,6 +343,12 @@
     char *name;
     object *v;
 {
+
+	if (v == NULL) {
+		err_setstr(TypeError,
+			   "can't delete sun audio status attributes");
+		return NULL;
+	}
 	return setmember((char *)&xp->ai, sads_ml, name, v);
 }
 
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 19f887c..514869c 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -133,8 +133,13 @@
 			return -1;
 		}
 	}
-	if (v == NULL)
-		return dictremove(op->cl_methods, name);
+	if (v == NULL) {
+		int rv = dictremove(op->cl_methods, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+				   "delete non-existing class attribute");
+		return rv;
+	}
 	else
 		return dictinsert(op->cl_methods, name, v);
 }
@@ -245,8 +250,13 @@
 			return -1;
 		}
 	}
-	if (v == NULL)
-		return dictremove(inst->in_attr, name);
+	if (v == NULL) {
+		int rv = dictremove(inst->in_attr, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+				   "delete non-existing instance attribute");
+		return rv;
+	}
 	else
 		return dictinsert(inst->in_attr, name, v);
 }
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index bbe927c..aedba35 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -132,11 +132,16 @@
 	object *v;
 {
 	if (strcmp(name, "__dict__") == 0 || strcmp(name, "__name__") == 0) {
-		err_setstr(TypeError, "can't assign to reserved member name");
+		err_setstr(TypeError, "read-only special attribute");
 		return -1;
 	}
-	if (v == NULL)
-		return dictremove(m->md_dict, name);
+	if (v == NULL) {
+		int rv = dictremove(m->md_dict, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+				   "delete non-existing module attribute");
+		return rv;
+	}
 	else
 		return dictinsert(m->md_dict, name, v);
 }
diff --git a/Objects/xxobject.c b/Objects/xxobject.c
index 7ab7a73..8471893 100644
--- a/Objects/xxobject.c
+++ b/Objects/xxobject.c
@@ -110,8 +110,13 @@
 		if (xp->x_attr == NULL)
 			return -1;
 	}
-	if (v == NULL)
-		return dictremove(xp->x_attr, name);
+	if (v == NULL) {
+		int rv = dictremove(xp->x_attr, name);
+		if (rv < 0)
+			err_setstr(AttributeError,
+			        "delete non-existing xx attribute");
+		return rv;
+	}
 	else
 		return dictinsert(xp->x_attr, name, v);
 }