diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-01-04 17:19:16 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-01-04 17:19:16 +0200 |
commit | 343ca1e63ae90b13af8d0a71f6ed6fc5a6284e33 (patch) | |
tree | 4c266a09defd78f88c7b582fca99b5cdf58d3b0c /py | |
parent | 51af362e31263a1aabbc179489bc99618cd4c6f0 (diff) | |
download | micropython-343ca1e63ae90b13af8d0a71f6ed6fc5a6284e33.tar.gz micropython-343ca1e63ae90b13af8d0a71f6ed6fc5a6284e33.zip |
objarray: Make sure that longint works as bytearray size.
Diffstat (limited to 'py')
-rw-r--r-- | py/objarray.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objarray.c b/py/objarray.c index 19705afc02..2634190dd3 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -191,9 +191,9 @@ STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t if (n_args == 0) { // no args: construct an empty bytearray return array_new(BYTEARRAY_TYPECODE, 0); - } else if (MP_OBJ_IS_SMALL_INT(args[0])) { + } else if (MP_OBJ_IS_INT(args[0])) { // 1 arg, an integer: construct a blank bytearray of that length - mp_uint_t len = MP_OBJ_SMALL_INT_VALUE(args[0]); + mp_uint_t len = mp_obj_get_int(args[0]); mp_obj_array_t *o = array_new(BYTEARRAY_TYPECODE, len); memset(o->items, 0, len); return o; |