Commit 5a03ae22 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix a few more list refcount issues

parent 8b483912
......@@ -451,13 +451,13 @@ Box* sorted(Box* obj, Box* cmp, Box* key, Box** args) {
Box* reverse = args[0];
BoxedList* rtn = new BoxedList();
KEEP_ALIVE(rtn);
AUTO_DECREF(rtn);
for (Box* e : obj->pyElements()) {
listAppendInternalStolen(rtn, e);
}
listSort(rtn, cmp, key, reverse);
return rtn;
return incref(rtn);
}
Box* isinstance_func(Box* obj, Box* cls) {
......
......@@ -889,6 +889,7 @@ public:
PyCmpComparer(Box* cmp) : cmp(cmp) {}
bool operator()(Box* lhs, Box* rhs) {
Box* r = runtimeCallInternal<CXX, NOT_REWRITABLE>(cmp, NULL, ArgPassSpec(2), lhs, rhs, NULL, NULL, NULL);
AUTO_DECREF(r);
if (!PyInt_Check(r))
raiseExcHelper(TypeError, "comparison function must return int, not %.200s", r->cls->tp_name);
return static_cast<BoxedInt*>(r)->n < 0;
......
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