fixes for mp_type_get_protocol_slot

This commit is contained in:
Jeff Epler 2023-09-22 13:51:57 -05:00
parent 566688b028
commit 556ec9d300
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@
#ifndef MICROPY_UNSAFE_PROTO #ifndef MICROPY_UNSAFE_PROTO
const void *mp_proto_get(uint16_t name, mp_const_obj_t obj) { const void *mp_proto_get(uint16_t name, mp_const_obj_t obj) {
const mp_obj_type_t *type = mp_obj_get_type(obj); const mp_obj_type_t *type = mp_obj_get_type(obj);
const void *protocol = mp_type_get_protocol_slot(type); const void *protocol = MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, protocol);
if (!protocol) { if (!protocol) {
return NULL; return NULL;
} }

View File

@ -31,7 +31,7 @@
#define MP_PROTOCOL_HEAD /* NOTHING */ #define MP_PROTOCOL_HEAD /* NOTHING */
#define MP_PROTO_IMPLEMENT(name) /* NOTHING */ #define MP_PROTO_IMPLEMENT(name) /* NOTHING */
static inline void *mp_proto_get(uint16_t name, mp_const_obj_type_t obj) { static inline void *mp_proto_get(uint16_t name, mp_const_obj_type_t obj) {
return mp_type_get_protocol_slot(mp_obj_get_type(obj)); return MP_OBJ_TYPE_GET_SLOT_OR_NULL(mp_obj_get_type(obj), protocol);
} }
#else #else
#define MP_PROTOCOL_HEAD \ #define MP_PROTOCOL_HEAD \