Commit 83965b0c authored by Kevin Modzelewski's avatar Kevin Modzelewski

More fixes

parent c3e72d12
......@@ -510,7 +510,6 @@ template Box* instanceGetattroInternal<CAPI>(Box*, Box*, GetattrRewriteArgs*) no
template Box* instanceGetattroInternal<CXX>(Box*, Box*, GetattrRewriteArgs*);
void instanceSetattroInternal(Box* _inst, Box* _attr, STOLEN(Box*) value, SetattrRewriteArgs* rewrite_args) {
assert(0 && "check refcounting");
STAT_TIMER(t0, "us_timer_instance_setattro", 0);
RELEASE_ASSERT(_inst->cls == instance_cls, "");
......@@ -530,7 +529,9 @@ void instanceSetattroInternal(Box* _inst, Box* _attr, STOLEN(Box*) value, Setatt
if (value->cls != classobj_cls)
raiseExcHelper(TypeError, "__class__ must be set to a class");
auto old_cls = inst->inst_cls;
inst->inst_cls = static_cast<BoxedClassobj*>(value);
Py_DECREF(old_cls);
return;
}
}
......
......@@ -6847,10 +6847,9 @@ extern "C" Box* importStar(Box* _from_module, Box* to_globals) {
static BoxedString* all_str = getStaticString("__all__");
Box* all = from_module->getattr(all_str);
Py_INCREF(all);
AUTO_DECREF(all);
if (all) {
KEEP_ALIVE(all);
static BoxedString* getitem_str = getStaticString("__getitem__");
Box* all_getitem = typeLookup(all->cls, getitem_str);
if (!all_getitem)
......
......@@ -688,7 +688,7 @@ static Box* unicodeNewHelper(BoxedClass* type, Box* string, Box* encoding_obj, B
Box* args;
if (!string)
args = EmptyTuple;
args = incref(EmptyTuple);
else if (!encoding_obj)
args = BoxedTuple::create1(string);
else if (!errors_obj)
......@@ -696,6 +696,8 @@ static Box* unicodeNewHelper(BoxedClass* type, Box* string, Box* encoding_obj, B
else
args = BoxedTuple::create3(string, encoding_obj, errors_obj);
AUTO_DECREF(args);
int init_code = r->cls->tp_init(r, args, NULL);
if (init_code == -1)
throwCAPIException();
......@@ -772,7 +774,7 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
if (rewrite_args) {
rewrite_args->out_rtn
= rewrite_args->rewriter->call(true, (void*)unicodeNewHelper, rewrite_args->arg1, rewrite_args->arg2,
rewrite_args->arg3, rewrite_args->args);
rewrite_args->arg3, rewrite_args->args)->setType(RefType::OWNED);
rewrite_args->out_success = true;
}
......
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