Commit a38d319c authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix a bunch of 'return self' that were missing increfs

parent f665e516
......@@ -1351,7 +1351,7 @@ public:
static Box* iter(Box* _self) noexcept {
assert(_self->cls == enumerate_cls);
BoxedEnumerate* self = static_cast<BoxedEnumerate*>(_self);
return self;
return incref(self);
}
static Box* next(Box* _self) {
......
......@@ -1036,7 +1036,7 @@ extern "C" Box* floatFloat(BoxedFloat* self) {
getTypeName(self));
if (self->cls == float_cls)
return self;
return incref(self);
return boxFloat(self->d);
}
......
......@@ -185,8 +185,7 @@ Box* xrange(Box* cls, Box* start, Box* stop, Box** args) {
Box* xrangeIterIter(Box* self) {
assert(self->cls == xrange_iterator_cls);
Py_INCREF(self);
return self;
return incref(self);
}
Box* xrangeIter(Box* self) noexcept {
......
......@@ -1083,7 +1083,7 @@ extern "C" Box* intHash(BoxedInt* self) {
return boxInt(-2);
if (self->cls == int_cls)
return self;
return incref(self);
return boxInt(self->n);
}
......@@ -1155,7 +1155,7 @@ extern "C" Box* intTrunc(BoxedInt* self) {
getTypeName(self));
if (self->cls == int_cls)
return self;
return incref(self);
return boxInt(self->n);
}
......@@ -1165,7 +1165,7 @@ extern "C" Box* intInt(BoxedInt* self) {
getTypeName(self));
if (self->cls == int_cls)
return self;
return incref(self);
return boxInt(self->n);
}
......
......@@ -784,8 +784,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
int s2 = rhs->size;
if (s2 == 0) {
Py_INCREF(self);
return self;
return incref(self);
}
self->ensure(s1 + s2);
......@@ -796,8 +795,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
Py_INCREF(self->elts->elts[i + s1]);
}
Py_INCREF(self);
return self;
return incref(self);
}
if (_rhs->cls == tuple_cls) {
......@@ -807,8 +805,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
int s2 = rhs->ob_size;
if (s2 == 0) {
Py_INCREF(self);
return self;
return incref(self);
}
self->ensure(s1 + s2);
......@@ -819,8 +816,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
Py_INCREF(self->elts->elts[i + s1]);
}
Py_INCREF(self);
return self;
return incref(self);
}
RELEASE_ASSERT(_rhs != self, "unsupported");
......@@ -828,8 +824,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
for (auto* b : _rhs->pyElements())
listAppendInternalStolen(self, b);
Py_INCREF(self);
return self;
return incref(self);
}
Box* listExtend(BoxedList* self, Box* _rhs) {
......
......@@ -1577,7 +1577,7 @@ extern "C" Box* longTrunc(BoxedLong* self) {
raiseExcHelper(TypeError, "descriptor '__trunc__' requires a 'long' object but received a '%s'",
getTypeName(self));
return self;
return incref(self);
}
extern "C" Box* longIndex(BoxedLong* v) noexcept {
......
......@@ -183,7 +183,7 @@ Box* tupleMulInt(BoxedTuple* self, int n) {
n = 0;
if ((s == 0 || n == 1) && PyTuple_CheckExact(self)) {
return self;
return incref(self);
} else {
BoxedTuple* rtn = BoxedTuple::create(n * s);
int rtn_i = 0;
......
# expected: reffail
import math
def type_trunc(type, arg):
......
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