py/objtype: Use locals_ptr directly instead of getting it from the slot.

This is a very minor code simplification, which reduces code size by about
-8 bytes.  It should have no functional change.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-08-11 16:52:29 +10:00
parent bd413d3d85
commit 3650196682

View File

@@ -1292,8 +1292,7 @@ static mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals
mp_raise_TypeError(MP_ERROR_TEXT("multiple bases have instance lay-out conflict"));
}
mp_map_t *locals_map = &MP_OBJ_TYPE_GET_SLOT(o, locals_dict)->map;
mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(MP_QSTR___new__), MP_MAP_LOOKUP);
mp_map_elem_t *elem = mp_map_lookup(&locals_ptr->map, MP_OBJ_NEW_QSTR(MP_QSTR___new__), MP_MAP_LOOKUP);
if (elem != NULL) {
// __new__ slot exists; check if it is a function
if (mp_obj_is_fun(elem->value)) {