py/dynruntime: Add mp_binary_get_size/get_val_array/set_val_array.

These are needed to read/write array.array objects, which is useful in
native code to provide fast extensions that work with big arrays of data.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-03-25 13:10:12 +11:00
parent 4662a71f44
commit d2276f0d41
4 changed files with 16 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include <string.h>
#include <assert.h>
#include "py/binary.h"
#include "py/runtime.h"
#include "py/smallint.h"
#include "py/nativeglue.h"
@@ -330,6 +331,9 @@ const mp_fun_table_t mp_fun_table = {
mp_obj_get_float_to_d,
mp_get_buffer,
mp_get_stream_raise,
mp_binary_get_size,
mp_binary_get_val_array,
mp_binary_set_val_array,
&mp_plat_print,
&mp_type_type,
&mp_type_str,