summaryrefslogtreecommitdiffstatshomepage
path: root/py/objarray.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-07-02 16:26:57 +0100
committerDamien George <damien.p.george@gmail.com>2015-07-02 16:26:57 +0100
commit035deae1c6fb02f6754a21486966f76c02b64c98 (patch)
tree56f66084a1c12edeea64571abf83b519ca76a718 /py/objarray.c
parent5161239c9f671af2f8ad56ebda9aabb93ec2e5ab (diff)
downloadmicropython-035deae1c6fb02f6754a21486966f76c02b64c98.tar.gz
micropython-035deae1c6fb02f6754a21486966f76c02b64c98.zip
py/objarray.c: Allow to build with debugging and bytearray but no array.
Diffstat (limited to 'py/objarray.c')
-rw-r--r--py/objarray.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objarray.c b/py/objarray.c
index f6c0436be1..404833e743 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -130,7 +130,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
&& typecode == BYTEARRAY_TYPECODE)
|| (MICROPY_PY_ARRAY
&& (MP_OBJ_IS_TYPE(initializer, &mp_type_bytes)
- || MP_OBJ_IS_TYPE(initializer, &mp_type_bytearray))))
+ || (MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE(initializer, &mp_type_bytearray)))))
&& mp_get_buffer(initializer, &bufinfo, MP_BUFFER_READ)) {
// construct array from raw bytes
// 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)
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
- assert(MP_OBJ_IS_TYPE(self_in, &mp_type_array) || MP_OBJ_IS_TYPE(self_in, &mp_type_bytearray));
+ assert((MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE(self_in, &mp_type_bytearray))
+ || (MICROPY_PY_ARRAY && MP_OBJ_IS_TYPE(self_in, &mp_type_array)));
mp_obj_array_t *self = self_in;
if (self->free == 0) {
@@ -319,7 +320,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_append_obj, array_append);
STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
- assert(MP_OBJ_IS_TYPE(self_in, &mp_type_array) || MP_OBJ_IS_TYPE(self_in, &mp_type_bytearray));
+ assert((MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE(self_in, &mp_type_bytearray))
+ || (MICROPY_PY_ARRAY && MP_OBJ_IS_TYPE(self_in, &mp_type_array)));
mp_obj_array_t *self = self_in;
// allow to extend by anything that has the buffer protocol (extension to CPython)