From a785a3dbfb02f5df901e78dfc63cf31502677d82 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 14 Aug 2018 16:23:21 +1000 Subject: [PATCH] py/objarray: Allow to build again when bytearray is disabled. --- py/objarray.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index aa9fa3b737..56038a7d68 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -270,10 +270,10 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs } case MP_BINARY_OP_CONTAINS: { + #if MICROPY_PY_BUILTINS_BYTEARRAY + // Can search string only in bytearray mp_buffer_info_t lhs_bufinfo; mp_buffer_info_t rhs_bufinfo; - - // Can search string only in bytearray if (mp_get_buffer(rhs_in, &rhs_bufinfo, MP_BUFFER_READ)) { if (!MP_OBJ_IS_TYPE(lhs_in, &mp_type_bytearray)) { return mp_const_false; @@ -282,6 +282,7 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs return mp_obj_new_bool( find_subbytes(lhs_bufinfo.buf, lhs_bufinfo.len, rhs_bufinfo.buf, rhs_bufinfo.len, 1) != NULL); } + #endif // Otherwise, can only look for a scalar numeric value in an array if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {