summaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-07-15 14:31:06 +1000
committerDamien George <damien@micropython.org>2022-09-19 18:40:39 +1000
commitfb2a57800acffd811d05373dcf63e95b4048d0c6 (patch)
tree3fde2aa0ed288ad851faeba7fe141c14404ee0ae /py/obj.c
parentca51d63c37e6ca67bec0a645e2aeea71aba91058 (diff)
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>
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/obj.c b/py/obj.c
index b461fe50a..eeadd3eed 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -579,10 +579,10 @@ mp_obj_t mp_identity_getiter(mp_obj_t self, mp_obj_iter_buf_t *iter_buf) {
bool mp_get_buffer(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
const mp_obj_type_t *type = mp_obj_get_type(obj);
- if (type->buffer_p.get_buffer == NULL) {
+ if (type->buffer == NULL) {
return false;
}
- int ret = type->buffer_p.get_buffer(obj, bufinfo, flags);
+ int ret = type->buffer(obj, bufinfo, flags);
if (ret != 0) {
return false;
}