diff --git a/py/dynruntime.h b/py/dynruntime.h index 90c401ab4b..de9c93c659 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -125,7 +125,8 @@ static inline void *m_realloc_dyn(void *ptr, size_t new_num_bytes) { #define mp_obj_get_int_truncated(o) (mp_fun_table.native_from_obj(o, MP_NATIVE_TYPE_UINT)) #define mp_obj_str_get_str(s) (mp_obj_str_get_data_dyn((s), NULL)) #define mp_obj_str_get_data(o, len) (mp_obj_str_get_data_dyn((o), (len))) -#define mp_get_buffer_raise(o, bufinfo, fl) (mp_fun_table.get_buffer_raise((o), (bufinfo), (fl))) +#define mp_get_buffer(o, bufinfo, fl) (mp_fun_table.get_buffer((o), (bufinfo), (fl))) +#define mp_get_buffer_raise(o, bufinfo, fl) (mp_fun_table.get_buffer((o), (bufinfo), (fl) | MP_BUFFER_RAISE_IF_UNSUPPORTED)) #define mp_get_stream_raise(s, flags) (mp_fun_table.get_stream_raise((s), (flags))) #define mp_obj_is_true(o) (mp_fun_table.native_from_obj(o, MP_NATIVE_TYPE_BOOL)) diff --git a/py/nativeglue.c b/py/nativeglue.c index d92d815abd..217c6b3df3 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -328,7 +328,7 @@ const mp_fun_table_t mp_fun_table = { mp_obj_new_float_from_d, mp_obj_get_float_to_f, mp_obj_get_float_to_d, - mp_get_buffer_raise, + mp_get_buffer, mp_get_stream_raise, &mp_plat_print, &mp_type_type, diff --git a/py/nativeglue.h b/py/nativeglue.h index 7b1ccd8d46..cf73ffbfc3 100644 --- a/py/nativeglue.h +++ b/py/nativeglue.h @@ -154,7 +154,7 @@ typedef struct _mp_fun_table_t { mp_obj_t (*obj_new_float_from_d)(double d); float (*obj_get_float_to_f)(mp_obj_t o); double (*obj_get_float_to_d)(mp_obj_t o); - void (*get_buffer_raise)(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags); + bool (*get_buffer)(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags); const mp_stream_p_t *(*get_stream_raise)(mp_obj_t self_in, int flags); const mp_print_t *plat_print; const mp_obj_type_t *type_type;