Commit 88ca604b authored by Kevin Modzelewski's avatar Kevin Modzelewski

More ref fixes

parent ec8adc6f
......@@ -4087,7 +4087,7 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
if (!param_names || !param_names->takes_param_names) {
assert(!rewrite_args); // would need to add it to r_kwargs
okwargs->d[(*keyword_names)[i]] = kw_val;
okwargs->d[incref((*keyword_names)[i])] = incref(kw_val);
continue;
}
......@@ -4297,7 +4297,6 @@ Box* callFunc(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args, ArgPassSpe
AUTO_XDECREF_ARRAY(oargs, num_output_args - 3);
if (rewrite_args && !rewrite_success) {
assert(0 && "check refcounting");
// These are the cases that we weren't able to rewrite.
// So instead, just rewrite them to be a call to callFunc, which helps a little bit.
// TODO we should extract the rest of this function from the end of this block,
......@@ -4352,7 +4351,7 @@ Box* callFunc(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args, ArgPassSpe
arg_vec.push_back(args_array);
for (auto v : arg_vec)
assert(v);
RewriterVar* r_rtn = rewriter->call(true, (void*)_callFuncHelper<S>, arg_vec);
RewriterVar* r_rtn = rewriter->call(true, (void*)_callFuncHelper<S>, arg_vec)->setType(RefType::OWNED);
rewrite_args->out_success = true;
rewrite_args->out_rtn = r_rtn;
......
......@@ -2472,8 +2472,6 @@ public:
RELEASE_ASSERT(_self->cls == attrwrapper_cls, "");
AttrWrapper* self = static_cast<AttrWrapper*>(_self);
assert(0 && "check refcounting");
assert(args->cls == tuple_cls);
assert(!kwargs || kwargs->cls == dict_cls);
......@@ -2495,14 +2493,18 @@ public:
// Hopefully this does not happen very often.
if (!PyDict_Check(_container)) {
BoxedDict* new_container = new BoxedDict();
dictUpdate(new_container, BoxedTuple::create({ _container }), new BoxedDict());
dictUpdate(new_container, autoDecref(BoxedTuple::create({ _container })), NULL);
_container = new_container;
} else {
Py_INCREF(_container);
}
AUTO_DECREF(_container);
assert(PyDict_Check(_container));
BoxedDict* container = static_cast<BoxedDict*>(_container);
for (const auto& p : *container) {
AttrWrapper::setitem(self, p.first, p.second);
autoDecref(AttrWrapper::setitem(self, p.first, p.second));
}
}
};
......@@ -2513,7 +2515,7 @@ public:
if (kwargs)
handle(kwargs);
return None;
Py_RETURN_NONE;
}
static Box* iter(Box* _self) noexcept {
......
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