@@ -130,7 +130,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
130130 && typecode == BYTEARRAY_TYPECODE )
131131 || (MICROPY_PY_ARRAY
132132 && (MP_OBJ_IS_TYPE (initializer , & mp_type_bytes )
133- || MP_OBJ_IS_TYPE (initializer , & mp_type_bytearray ))))
133+ || ( MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE (initializer , & mp_type_bytearray ) ))))
134134 && mp_get_buffer (initializer , & bufinfo , MP_BUFFER_READ )) {
135135 // construct array from raw bytes
136136 // we round-down the len to make it a multiple of sz (CPython raises error)
@@ -301,7 +301,8 @@ STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
301301#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
302302STATIC mp_obj_t array_append (mp_obj_t self_in , mp_obj_t arg ) {
303303 // self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
304- assert (MP_OBJ_IS_TYPE (self_in , & mp_type_array ) || MP_OBJ_IS_TYPE (self_in , & mp_type_bytearray ));
304+ assert ((MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE (self_in , & mp_type_bytearray ))
305+ || (MICROPY_PY_ARRAY && MP_OBJ_IS_TYPE (self_in , & mp_type_array )));
305306 mp_obj_array_t * self = self_in ;
306307
307308 if (self -> free == 0 ) {
@@ -319,7 +320,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_append_obj, array_append);
319320
320321STATIC mp_obj_t array_extend (mp_obj_t self_in , mp_obj_t arg_in ) {
321322 // self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
322- assert (MP_OBJ_IS_TYPE (self_in , & mp_type_array ) || MP_OBJ_IS_TYPE (self_in , & mp_type_bytearray ));
323+ assert ((MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE (self_in , & mp_type_bytearray ))
324+ || (MICROPY_PY_ARRAY && MP_OBJ_IS_TYPE (self_in , & mp_type_array )));
323325 mp_obj_array_t * self = self_in ;
324326
325327 // allow to extend by anything that has the buffer protocol (extension to CPython)
0 commit comments