From 2ca84aa01edd1f955df3fe9cd581f1a421f89a79 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 26 Jan 2014 01:57:48 +0200 Subject: Add MP_OBJ_IS_INT(), for symmetry with MP_OBJ_IS_STR(). --- py/obj.h | 1 + 1 file changed, 1 insertion(+) (limited to 'py') diff --git a/py/obj.h b/py/obj.h index b33e3c598..9c6a35422 100644 --- a/py/obj.h +++ b/py/obj.h @@ -40,6 +40,7 @@ typedef struct _mp_obj_base_t mp_obj_base_t; #define MP_OBJ_IS_QSTR(o) ((((mp_small_int_t)(o)) & 3) == 2) #define MP_OBJ_IS_OBJ(o) ((((mp_small_int_t)(o)) & 3) == 0) #define MP_OBJ_IS_TYPE(o, t) (MP_OBJ_IS_OBJ(o) && (((mp_obj_base_t*)(o))->type == (t))) // this does not work for checking a string, use below macro for that +#define MP_OBJ_IS_INT(o) (MP_OBJ_IS_SMALL_INT(o) || MP_OBJ_IS_TYPE(o, &int_type)) #define MP_OBJ_IS_STR(o) (MP_OBJ_IS_QSTR(o) || MP_OBJ_IS_TYPE(o, &str_type)) #define MP_OBJ_SMALL_INT_VALUE(o) (((mp_small_int_t)(o)) >> 1) -- cgit v1.2.3 From 9d95a2b21d79dc7eebfae9bf6d6dfd69388329f4 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 26 Jan 2014 01:58:51 +0200 Subject: Functions of fixed number of args are special-cased only for 3 or less args. --- py/objfun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py') diff --git a/py/objfun.c b/py/objfun.c index 1f6ad68ea..fe4f49430 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -63,7 +63,7 @@ mp_obj_t fun_native_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_ return res; - } else if (self->n_args_min == self->n_args_max) { + } else if (self->n_args_min <= 3 && self->n_args_min == self->n_args_max) { // function requires a fixed number of arguments // dispatch function call -- cgit v1.2.3