mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t.
Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer, so enforce this const-ness throughout the code base. If a type ever needs to be modified (eg a user type) then a simple cast can be used.
This commit is contained in:
@@ -146,7 +146,7 @@ typedef struct _mp_fun_table_t {
|
||||
NORETURN // Only certain compilers support no-return attributes in function pointer declarations
|
||||
#endif
|
||||
void (*raise_msg)(const mp_obj_type_t *exc_type, const char *msg);
|
||||
mp_obj_type_t *(*obj_get_type)(mp_const_obj_t o_in);
|
||||
const mp_obj_type_t *(*obj_get_type)(mp_const_obj_t o_in);
|
||||
mp_obj_t (*obj_new_str)(const char* data, size_t len);
|
||||
mp_obj_t (*obj_new_bytes)(const byte* data, size_t len);
|
||||
mp_obj_t (*obj_new_bytearray_by_ref)(size_t n, void *items);
|
||||
|
||||
Reference in New Issue
Block a user