Skip to content

Commit 88434c5

Browse files
committed
Rename mp_type_parent -> mp_type_get_parent_slot
1 parent 75e995f commit 88434c5

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

extmod/ulab

Submodule ulab updated from 75c7e05 to e2e9111

py/dynruntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static inline mp_obj_t mp_obj_cast_to_native_base_dyn(mp_obj_t self_in, mp_const
141141
if (MP_OBJ_FROM_PTR(self_type) == native_type) {
142142
return self_in;
143143
}
144-
mp_parent_t parent = mp_type_parent(self_type);
144+
mp_parent_t parent = mp_type_get_parent_slot(self_type);
145145
if (parent != native_type) {
146146
// The self_in object is not a direct descendant of native_type, so fail the cast.
147147
// This is a very simple version of mp_obj_is_subclass_fast that could be improved.

py/obj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ const void *mp_type_get_protocol_slot(const mp_obj_type_t *type) {
746746
}
747747

748748

749-
const void *mp_type_parent(const mp_obj_type_t *type) {
749+
const void *mp_type_get_parent_slot(const mp_obj_type_t *type) {
750750
return type->parent;
751751
}
752752

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ extern const void *mp_type_get_protocol_slot(const mp_obj_type_t *);
674674
// These fields ended up not being placed in the extended area, but accessors
675675
// were created for them anyway.
676676
extern mp_attr_fun_t mp_type_attr(const mp_obj_type_t *);
677-
extern const void *mp_type_parent(const mp_obj_type_t *);
677+
extern const void *mp_type_get_parent_slot(const mp_obj_type_t *);
678678

679679
// Return the size of a type object, which can be one of two lengths depending whether it has
680680
// the extended fields or not.

py/objtype.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ STATIC int instance_count_native_bases(const mp_obj_type_t *type, const mp_obj_t
6565
*last_native_base = type;
6666
return count + 1;
6767
}
68-
const void *parent = mp_type_parent(type);
68+
const void *parent = mp_type_get_parent_slot(type);
6969
if (parent == NULL) {
7070
// No parents so end search here.
7171
return count;
@@ -215,7 +215,7 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_t
215215

216216
// attribute not found, keep searching base classes
217217

218-
const void *parent = mp_type_parent(type);
218+
const void *parent = mp_type_get_parent_slot(type);
219219
if (parent == NULL) {
220220
DEBUG_printf("mp_obj_class_lookup: No more parents\n");
221221
return;
@@ -1085,7 +1085,7 @@ STATIC void type_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
10851085
dest[0] = mp_const_empty_tuple;
10861086
return;
10871087
}
1088-
const void *parent = mp_type_parent(self);
1088+
const void *parent = mp_type_get_parent_slot(self);
10891089
mp_obj_t parent_obj = parent ? MP_OBJ_FROM_PTR(parent) : MP_OBJ_FROM_PTR(&mp_type_object);
10901090
#if MICROPY_MULTIPLE_INHERITANCE
10911091
if (mp_obj_is_type(parent_obj, &mp_type_tuple)) {
@@ -1334,7 +1334,7 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
13341334
lookup.meth_offset = offsetof(mp_obj_type_t, make_new);
13351335
}
13361336

1337-
const void *parent = mp_type_parent(type);
1337+
const void *parent = mp_type_get_parent_slot(type);
13381338
if (parent == NULL) {
13391339
// no parents, do nothing
13401340
#if MICROPY_MULTIPLE_INHERITANCE
@@ -1430,7 +1430,7 @@ bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo) {
14301430
}
14311431

14321432
const mp_obj_type_t *self = MP_OBJ_TO_PTR(object);
1433-
const void *parent = mp_type_parent(self);
1433+
const void *parent = mp_type_get_parent_slot(self);
14341434

14351435
if (parent == NULL) {
14361436
// type has no parents

0 commit comments

Comments
 (0)