From b7f7c655ed4b54d9ff8ec04908199d04d38b7528 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Tue, 26 Aug 2014 12:44:46 -0700 Subject: Make int(b'123') work properly. --- py/objint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/objint.c') diff --git a/py/objint.c b/py/objint.c index d088ae1a8..a77138350 100644 --- a/py/objint.c +++ b/py/objint.c @@ -57,7 +57,7 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, co if (MP_OBJ_IS_INT(args[0])) { // already an int (small or long), just return it return args[0]; - } else if (MP_OBJ_IS_STR(args[0])) { + } else if (MP_OBJ_IS_STR_OR_BYTES(args[0])) { // a string, parse it uint l; const char *s = mp_obj_str_get_data(args[0], &l); -- cgit v1.2.3 From a75b02ea9be41c27b87fd80ad37e7c26b4583fad Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 27 Aug 2014 09:20:30 +0100 Subject: py: Improve efficiency of MP_OBJ_IS_STR_OR_BYTES. Saves ROM (16 on stmhal, 240 on 64-bit unix) and should be quicker since there is 1 less branch. --- py/objint.c | 1 + 1 file changed, 1 insertion(+) (limited to 'py/objint.c') diff --git a/py/objint.c b/py/objint.c index a77138350..c190c1800 100644 --- a/py/objint.c +++ b/py/objint.c @@ -38,6 +38,7 @@ #include "smallint.h" #include "mpz.h" #include "objint.h" +#include "objstr.h" #include "runtime0.h" #include "runtime.h" -- cgit v1.2.3