diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index 3f122058..a6a27df1 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -934,7 +934,9 @@ static void BinaryExpr__emit_(Expr* self_, Ctx* ctx) { Ctx__emit_(ctx, opcode, arg, self->line); - c11__foreach(int, &jmps, i) { Ctx__patch_jump(ctx, *i); } + for(int i = 0; i < jmps.count; i++) { + Ctx__patch_jump(ctx, c11__getitem(int, &jmps, i)); + } } BinaryExpr* BinaryExpr__new(int line, TokenIndex op, bool inplace) { diff --git a/src/public/values.c b/src/public/values.c index e4a35f1f..bf6df138 100644 --- a/src/public/values.c +++ b/src/public/values.c @@ -80,7 +80,9 @@ void py_newfunction2(py_Ref out, const py_Ref upvalue) {} void py_newnativefunc(py_Ref out, py_CFunction f) { - + out->type = tp_nativefunc; + out->is_ptr = false; + out->_cfunc = f; } void py_bindmethod(py_Type type, const char *name, py_CFunction f){ diff --git a/src2/main.c b/src2/main.c index 8519ff6e..ea1e1e15 100644 --- a/src2/main.c +++ b/src2/main.c @@ -25,7 +25,7 @@ int main(int argc, char** argv) { #endif py_initialize(); - const char* source = "[1, 'a']"; + const char* source = "[1+2, 'a']"; py_Ref r0 = py_reg(0); if(py_eval(source, r0)){