py: Add typecode to buffer protocol.
When querying an object that supports the buffer protocol, that object
must now return a typecode (as per binary.[ch]). This does not have to
be honoured by the caller, but can be useful for determining element
size.
diff --git a/py/objarray.c b/py/objarray.c
index bfd048e..c6da457 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -151,10 +151,11 @@
}
}
-STATIC machine_int_t array_get_buffer(mp_obj_t o_in, buffer_info_t *bufinfo, int flags) {
+STATIC machine_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, int flags) {
mp_obj_array_t *o = o_in;
bufinfo->buf = o->items;
bufinfo->len = o->len * mp_binary_get_size(o->typecode);
+ bufinfo->typecode = o->typecode;
return 0;
}