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