diff options
author | Damien George <damien.p.george@gmail.com> | 2014-06-28 10:30:53 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-06-28 10:30:53 +0100 |
commit | b1b840554d27659f760304713c98f5c7f2d7f74b (patch) | |
tree | c112d08faa88043084f4d4d19094127b31d4e2c2 /py/obj.c | |
parent | 8993fb6cf0677ce980ab56cbad326e4e6bc47811 (diff) | |
parent | 635b60e299509a85722db77c4409c78ca86dbdc7 (diff) |
Merge branch 'unicode'
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -357,7 +357,12 @@ uint mp_get_index(const mp_obj_type_t *type, machine_uint_t len, mp_obj_t index, // may return MP_OBJ_NULL mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) { - if (MP_OBJ_IS_STR(o_in) || MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) { + if ( +#if !MICROPY_PY_BUILTINS_STR_UNICODE + // It's simple - unicode is slow, non-unicode is fast + MP_OBJ_IS_STR(o_in) || +#endif + MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) { return MP_OBJ_NEW_SMALL_INT((machine_int_t)mp_obj_str_get_len(o_in)); } else { mp_obj_type_t *type = mp_obj_get_type(o_in); |