diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2021-07-15 14:31:06 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-09-19 18:40:39 +1000 |
commit | fb2a57800acffd811d05373dcf63e95b4048d0c6 (patch) | |
tree | 3fde2aa0ed288ad851faeba7fe141c14404ee0ae /py/objstr.c | |
parent | ca51d63c37e6ca67bec0a645e2aeea71aba91058 (diff) | |
download | micropython-fb2a57800acffd811d05373dcf63e95b4048d0c6.tar.gz micropython-fb2a57800acffd811d05373dcf63e95b4048d0c6.zip |
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/objstr.c')
-rw-r--r-- | py/objstr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c index 683d035e44..9dd7f65e66 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -2151,7 +2151,7 @@ const mp_obj_type_t mp_type_str = { .binary_op = mp_obj_str_binary_op, .subscr = bytes_subscr, .getiter = mp_obj_new_str_iterator, - .buffer_p = { .get_buffer = mp_obj_str_get_buffer }, + .buffer = mp_obj_str_get_buffer, .locals_dict = (mp_obj_dict_t *)&mp_obj_str_locals_dict, }; #endif // !MICROPY_PY_BUILTINS_STR_UNICODE @@ -2165,7 +2165,7 @@ const mp_obj_type_t mp_type_bytes = { .binary_op = mp_obj_str_binary_op, .subscr = bytes_subscr, .getiter = mp_obj_new_bytes_iterator, - .buffer_p = { .get_buffer = mp_obj_str_get_buffer }, + .buffer = mp_obj_str_get_buffer, .locals_dict = (mp_obj_dict_t *)&mp_obj_bytes_locals_dict, }; |