Commit 013e6135 authored by Kevin Modzelewski's avatar Kevin Modzelewski

A few more fixes

parent c38f6248
......@@ -915,11 +915,9 @@ BORROWED(Box*) FrameInfo::updateBoxedLocals() {
Box* val = closure->elts[derefInfo.offset];
Box* boxedName = name.getBox();
if (val != NULL) {
assert(0 &&" add refcounting");
d->d[boxedName] = val;
PyDict_SetItem(d, boxedName, val);
} else {
assert(0 &&" add refcounting");
d->d.erase(boxedName);
PyDict_DelItem(d, boxedName);
}
}
......
......@@ -226,6 +226,9 @@ Box* superInit(Box* _self, Box* _type, Box* obj) {
if (obj != NULL)
obj_type = superCheck<CXX>(type, obj);
assert(!self->type);
assert(!self->obj);
assert(!self->obj_type);
self->type = incref(type);
self->obj = incref(obj);
self->obj_type = incref(obj_type);
......
......@@ -1188,6 +1188,8 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
Box* initrtn;
// If there's a Python-level __init__ function, try calling it.
if (init_attr && init_attr->cls == function_cls) {
AUTO_DECREF(made); // In case init throws:
if (rewrite_args) {
// We are going to rewrite as a call to cls.init:
assert(which_init == MAKES_CLS);
......@@ -1221,6 +1223,8 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
keyword_names);
}
incref(made); // to cancel out the AUTO_DECREF
if (!initrtn) {
assert(S == CAPI);
return NULL;
......@@ -1254,6 +1258,7 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
rearrangeArguments(ParamReceiveSpec(1, 0, true, true), NULL, "", NULL, rewrite_args, rewrite_success,
argspec, made, arg2, arg3, args, NULL, keyword_names);
} catch (ExcInfo e) {
Py_DECREF(made);
if (S == CAPI) {
setCAPIException(e);
return NULL;
......@@ -1272,6 +1277,7 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
Py_DECREF(arg2);
Py_XDECREF(arg3);
if (err == -1) {
Py_DECREF(made);
if (S == CAPI)
return NULL;
else
......
# expected: reffail
class B(object):
def __new__(cls, arg1):
print "B.__new__", arg1
......
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