summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c18
1 files changed, 14 insertions, 4 deletions
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 @@ class_setattr(op, name, v)
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 @@ instance_setattr(inst, name, v)
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);
}