Commit cf179f85 authored by Marius Wachtler's avatar Marius Wachtler

Merge pull request #1128 from Daetalus/refcount_long_hash

Two minor refcounting fixing in int and long functions.
parents 4ca4c082 2c4a68a6
......@@ -1092,7 +1092,7 @@ Box* intAbs(BoxedInt* v) {
raiseExcHelper(TypeError, "descriptor '__abs__' requires a 'int' object but received a '%s'", getTypeName(v));
if (v->n == PYSTON_INT_MIN) {
return longNeg(boxLong(v->n));
return longNeg(autoDecref(boxLong(v->n)));
}
return boxInt(std::abs(v->n));
}
......
......@@ -1542,7 +1542,7 @@ bool longNonzeroUnboxed(BoxedLong* self) {
Box* longHash(BoxedLong* self) {
if (!PyLong_Check(self))
raiseExcHelper(TypeError, "descriptor '__pow__' requires a 'long' object but received a '%s'",
raiseExcHelper(TypeError, "descriptor '__hash__' requires a 'long' object but received a '%s'",
getTypeName(self));
// If the long fits into an int we have to return the same hash in order that we can find the value in a dict.
......@@ -1568,7 +1568,7 @@ Box* longHash(BoxedLong* self) {
long long_hash(PyObject* self) noexcept {
try {
return unboxInt(longHash((BoxedLong*)self));
return unboxInt(autoDecref(longHash((BoxedLong*)self)));
} catch (ExcInfo e) {
RELEASE_ASSERT(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