Commit b5b9c098 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some augassign support

parent 1b6c8e7e
......@@ -452,7 +452,7 @@ extern "C" Box* mod_i64_i64(i64 lhs, i64 rhs) {
extern "C" Box* pow_i64_i64(i64 lhs, i64 rhs, Box* mod) {
if (mod != None) {
if (!PyInt_Check(mod)) {
return NotImplemented;
return incref(NotImplemented);
}
BoxedInt* mod_int = static_cast<BoxedInt*>(mod);
if (mod_int->n == 0) {
......
......@@ -1003,14 +1003,14 @@ static PyObject* long_richcompare(Box* _v1, Box* _v2, int op) noexcept {
Box* convertToLong(Box* val) {
if (PyLong_Check(val)) {
return val;
return incref(val);
} else if (PyInt_Check(val)) {
BoxedInt* val_int = static_cast<BoxedInt*>(val);
BoxedLong* r = new BoxedLong();
mpz_init_set_si(r->n, val_int->n);
return r;
} else {
return NotImplemented;
return incref(NotImplemented);
}
}
......
......@@ -4956,7 +4956,6 @@ Box* binopInternal(Box* lhs, Box* rhs, int op_type, bool inplace, BinopRewriteAr
Box* irtn = NULL;
if (inplace) {
assert(0 && "check refcounting");
// XXX I think we need to make sure that we keep these strings alive?
DecrefHandle<BoxedString> iop_name(getInplaceOpName(op_type));
if (rewrite_args) {
......@@ -4990,6 +4989,7 @@ Box* binopInternal(Box* lhs, Box* rhs, int op_type, bool inplace, BinopRewriteAr
}
return irtn;
} else {
Py_DECREF(irtn);
assert(!rewrite_args);
}
}
......
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