Implemented int(str) in UNIX

This commit is contained in:
xyb
2014-01-14 21:39:05 +08:00
parent 729e9cce7b
commit c178ea471e
9 changed files with 248 additions and 4 deletions

View File

@@ -22,8 +22,9 @@ static mp_obj_t int_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args)
// TODO allow string as arg and parse it
return MP_OBJ_NEW_SMALL_INT(mp_obj_get_int(args[0]));
//case 2:
// TODO, parse with given base
case 2:
// TODO make args[0] and args[1] correct
return MP_OBJ_NEW_SMALL_INT(mp_obj_get_int_base(args[0], args[1]));
default:
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "int takes at most 2 arguments, %d given", (void*)(machine_int_t)n_args));