Commit d29e3525 authored by Boxiang Sun's avatar Boxiang Sun

decref val when attribute is not writable

parent cc5974c9
......@@ -2916,6 +2916,7 @@ bool dataDescriptorSetSpecialCases(Box* obj, STOLEN(Box*) val, Box* descr, Setat
// TODO type checking goes here
if (getset_descr->set == NULL) {
assert(attr_name->data()[attr_name->size()] == '\0');
Py_DECREF(val);
raiseExcHelper(AttributeError, "attribute '%s' of '%s' objects is not writable", attr_name->data(),
getTypeName(obj));
}
......
# expected: reffail
class C(object):
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment