py: Add mp_obj_is_integer; make mp_get_index check for long int.

mp_obj_is_integer should be used to check if an object is of integral
type.  It returns true for bool, small int and long int.
This commit is contained in:
Damien George
2014-04-09 19:55:33 +01:00
parent d99944acdd
commit b5fbd0ba87
3 changed files with 9 additions and 5 deletions

View File

@@ -369,6 +369,7 @@ void mp_obj_print(mp_obj_t o, mp_print_kind_t kind);
void mp_obj_print_exception(mp_obj_t exc);
int mp_obj_is_true(mp_obj_t arg);
bool mp_obj_is_integer(mp_obj_t o_in); // returns true if o_in is bool, small int, or long int
bool mp_obj_is_callable(mp_obj_t o_in);
machine_int_t mp_obj_hash(mp_obj_t o_in);
bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2);