objarray: Support array('O'), array of objects, as extension to CPython.
Might be useful at least for memoryview hacks.
diff --git a/py/binary.c b/py/binary.c
index 7a15971..927a426 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -141,6 +141,9 @@
case 'd':
return mp_obj_new_float(((double*)p)[index]);
#endif
+ // Extension to CPython: array of objects
+ case 'O':
+ return ((mp_obj_t*)p)[index];
}
return MP_OBJ_NEW_SMALL_INT(val);
}
@@ -300,6 +303,10 @@
((double*)p)[index] = mp_obj_get_float(val_in);
break;
#endif
+ // Extension to CPython: array of objects
+ case 'O':
+ ((mp_obj_t*)p)[index] = val_in;
+ break;
default:
mp_binary_set_val_array_from_int(typecode, p, index, mp_obj_get_int(val_in));
}