mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
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:
committed by
Damien George
parent
ca51d63c37
commit
fb2a57800a
@@ -580,7 +580,7 @@ const mp_obj_type_t mp_type_array = {
|
||||
.unary_op = array_unary_op,
|
||||
.binary_op = array_binary_op,
|
||||
.subscr = array_subscr,
|
||||
.buffer_p = { .get_buffer = array_get_buffer },
|
||||
.buffer_p = array_get_buffer,
|
||||
.locals_dict = (mp_obj_dict_t *)&mp_obj_array_locals_dict,
|
||||
};
|
||||
#endif
|
||||
@@ -596,7 +596,7 @@ const mp_obj_type_t mp_type_bytearray = {
|
||||
.unary_op = array_unary_op,
|
||||
.binary_op = array_binary_op,
|
||||
.subscr = array_subscr,
|
||||
.buffer_p = { .get_buffer = array_get_buffer },
|
||||
.buffer = array_get_buffer,
|
||||
.locals_dict = (mp_obj_dict_t *)&mp_obj_bytearray_locals_dict,
|
||||
};
|
||||
#endif
|
||||
@@ -617,7 +617,7 @@ const mp_obj_type_t mp_type_memoryview = {
|
||||
.locals_dict = (mp_obj_dict_t *)&mp_obj_memoryview_locals_dict,
|
||||
#endif
|
||||
.subscr = array_subscr,
|
||||
.buffer_p = { .get_buffer = array_get_buffer },
|
||||
.buffer = array_get_buffer,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user