all: Simplify buffer protocol to just a "get buffer" callback.

The buffer protocol type only has a single member, and this existing layout
creates problems for the upcoming split/slot-index mp_obj_type_t layout
optimisations.

If we need to make the buffer protocol more sophisticated in the future
either we can rely on the mp_obj_type_t optimisations to just add
additional slots to mp_obj_type_t or re-visit the buffer protocol then.

This change is a no-op in terms of generated code.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2021-07-15 14:31:06 +10:00
committed by Damien George
parent ca51d63c37
commit fb2a57800a
14 changed files with 19 additions and 24 deletions

View File

@@ -642,7 +642,7 @@ STATIC const mp_obj_type_t uctypes_struct_type = {
.attr = uctypes_struct_attr,
.subscr = uctypes_struct_subscr,
.unary_op = uctypes_struct_unary_op,
.buffer_p = { .get_buffer = uctypes_get_buffer },
.buffer = uctypes_get_buffer,
};
STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {