diff options
author | Rachel Dowdall <rjdowdall@gmail.com> | 2014-03-22 12:17:36 +0000 |
---|---|---|
committer | Rachel Dowdall <rjdowdall@gmail.com> | 2014-03-22 12:17:36 +0000 |
commit | 17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5 (patch) | |
tree | 36077e73d30aa91f94ed74b707facc86b7ed7937 /py/objfloat.c | |
parent | 300c8bd4c2c0c6d626a6aaeb873c22a8f8b9fc3f (diff) | |
parent | da8d21e0dd236ae5e31bfac4ff8d5b73ddd49282 (diff) | |
download | micropython-17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5.tar.gz micropython-17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'py/objfloat.c')
-rw-r--r-- | py/objfloat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/objfloat.c b/py/objfloat.c index 704b3d5998..c4567c4a38 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -39,10 +39,12 @@ STATIC mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m // a string, parse it uint l; const char *s = mp_obj_str_get_data(args[0], &l); - return mp_parse_num_decimal(s, l); + return mp_parse_num_decimal(s, l, false, false); } else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) { + // a float, just return it return args[0]; } else { + // something else, try to cast it to a float return mp_obj_new_float(mp_obj_get_float(args[0])); } |