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.
This commit is contained in:
@@ -55,7 +55,7 @@ STATIC mp_obj_t struct_unpack(mp_obj_t fmt_in, mp_obj_t data_in) {
|
||||
char fmt_type = get_fmt_type(&fmt);
|
||||
uint size = calcsize_items(fmt);
|
||||
mp_obj_tuple_t *res = mp_obj_new_tuple(size, NULL);
|
||||
buffer_info_t bufinfo;
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(data_in, &bufinfo);
|
||||
byte *p = bufinfo.buf;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user