summaryrefslogtreecommitdiffstatshomepage
path: root/py/objtuple.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-07-14 17:14:16 +1000
committerDamien George <damien@micropython.org>2022-09-19 19:06:07 +1000
commita52cd5b07d6d6e2502fff2bbfb9e5b96562452a4 (patch)
treeabfbfe05586fe9c19d31adb32e82c59481ad611a /py/objtuple.c
parente8355eb16357b0bd234a9bcab1c9e8b72fcdbabc (diff)
downloadmicropython-a52cd5b07d6d6e2502fff2bbfb9e5b96562452a4.tar.gz
micropython-a52cd5b07d6d6e2502fff2bbfb9e5b96562452a4.zip
py/obj: Add accessors for type slots and use everywhere.
This is a no-op, but sets the stage for changing the mp_obj_type_t representation. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/objtuple.c')
-rw-r--r--py/objtuple.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objtuple.c b/py/objtuple.c
index a684b13e6f..01b2fa1488 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -32,7 +32,7 @@
#include "py/runtime.h"
// type check is done on getiter method to allow tuple, namedtuple, attrtuple
-#define mp_obj_is_tuple_compatible(o) (mp_obj_get_type(o)->getiter == mp_obj_tuple_getiter)
+#define mp_obj_is_tuple_compatible(o) (MP_OBJ_TYPE_GET_SLOT_OR_NULL(mp_obj_get_type(o), getiter) == mp_obj_tuple_getiter)
/******************************************************************************/
/* tuple */
@@ -111,7 +111,7 @@ STATIC mp_obj_t tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t anothe
mp_check_self(mp_obj_is_tuple_compatible(self_in));
const mp_obj_type_t *another_type = mp_obj_get_type(another_in);
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in);
- if (another_type->getiter != mp_obj_tuple_getiter) {
+ if (MP_OBJ_TYPE_GET_SLOT_OR_NULL(another_type, getiter) != mp_obj_tuple_getiter) {
// Slow path for user subclasses
another_in = mp_obj_cast_to_native_base(another_in, MP_OBJ_FROM_PTR(&mp_type_tuple));
if (another_in == MP_OBJ_NULL) {