Commit 21b2c59e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Get float.py working

parent f3037964
......@@ -1465,7 +1465,8 @@ Box* divmod(Box* lhs, Box* rhs) {
Box* powFunc(Box* x, Box* y, Box* z) {
Box* rtn = PyNumber_Power(x, y, z);
checkAndThrowCAPIException();
if (!rtn)
throwCAPIException();
return rtn;
}
......
......@@ -1110,9 +1110,11 @@ Box* floatCoerce(BoxedFloat* _self, Box* other) {
Box* self = static_cast<Box*>(_self);
int result = float_coerce(&self, &other);
if (result == 0)
if (result == 0) {
AUTO_DECREF(self);
AUTO_DECREF(other);
return BoxedTuple::create({ self, other });
else if (result == 1)
} else if (result == 1)
return incref(NotImplemented);
else
throwCAPIException();
......
......@@ -1458,7 +1458,9 @@ Box* longPowLong(BoxedLong* lhs, Box* _rhs, Box* _mod) {
if (mpz_sgn(rhs_long->n) == -1) {
BoxedFloat* rhs_float = static_cast<BoxedFloat*>(longToFloat(rhs_long));
AUTO_DECREF(rhs_float);
BoxedFloat* lhs_float = static_cast<BoxedFloat*>(longToFloat(lhs));
AUTO_DECREF(lhs_float);
return boxFloat(pow_float_float(lhs_float->d, rhs_float->d));
}
......@@ -1633,6 +1635,8 @@ static PyObject* long_pow(PyObject* v, PyObject* w, PyObject* x) noexcept {
try {
PyLongObject* a, *b;
CONVERT_BINOP(v, w, &a, &b);
AUTO_DECREF((Box*)a);
AUTO_DECREF((Box*)b);
return longPow((BoxedLong*)a, (BoxedLong*)b, x);
} catch (ExcInfo e) {
setCAPIException(e);
......
# expected: reffail
print 123542598.12938712938192831293812983
f = 1.0
print f
......
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