diff options
| author | Damien George <damien@micropython.org> | 2023-05-12 23:14:44 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-05-19 13:33:54 +1000 |
| commit | ca9068e0efc5e53ff7042ef68ad4a4ec9ff91915 (patch) | |
| tree | 4e277242f5af8d056cc222ccefa540277ba917dc /py | |
| parent | 9accb7dd446f7f17720f574d0449c294c4df1685 (diff) | |
py/objarray: Disallow memoryview addition.
Following CPython. This is important for subsequent commits to work
correctly.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
| -rw-r--r-- | py/objarray.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/objarray.c b/py/objarray.c index 0d9411d7c..a3adb255e 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -292,6 +292,12 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs mp_obj_array_t *lhs = MP_OBJ_TO_PTR(lhs_in); switch (op) { case MP_BINARY_OP_ADD: { + #if MICROPY_PY_BUILTINS_MEMORYVIEW + if (lhs->base.type == &mp_type_memoryview) { + return MP_OBJ_NULL; // op not supported + } + #endif + // allow to add anything that has the buffer protocol (extension to CPython) mp_buffer_info_t lhs_bufinfo; mp_buffer_info_t rhs_bufinfo; |
