Commit e09c48b0 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Get __builtins__.setattr() working

parent 743aab56
......@@ -640,17 +640,18 @@ Box* getattrFuncInternal(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args,
}
Box* setattrFunc(Box* obj, Box* _str, Box* value) {
assert(0 && "check refcounting");
_str = coerceUnicodeToStr<CXX>(_str);
if (_str->cls != str_cls) {
Py_DECREF(_str);
raiseExcHelper(TypeError, "attribute name must be string, not '%s'", _str->cls->tp_name);
}
BoxedString* str = static_cast<BoxedString*>(_str);
internStringMortalInplace(str);
AUTO_DECREF(str);
setattr(obj, str, value);
setattr(obj, str, incref(value));
return incref(None);
}
......
# expected: reffail
class C(object):
def __init__(self, a):
print a
......
# expected: reffail
# statcheck: noninit_count('slowpath_runtimecall') <= 500
# statcheck: noninit_count('slowpath_callfunc') <= 500
# run_args: -n
......
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