@@ -113,13 +113,15 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
113
113
assert (lookup -> dest [0 ] == MP_OBJ_NULL );
114
114
assert (lookup -> dest [1 ] == MP_OBJ_NULL );
115
115
for (;;) {
116
+ DEBUG_printf ("mp_obj_class_lookup: Looking up %s in %s\n" , qstr_str (lookup -> attr ), qstr_str (type -> name ));
116
117
// Optimize special method lookup for native types
117
118
// This avoids extra method_name => slot lookup. On the other hand,
118
119
// this should not be applied to class types, as will result in extra
119
120
// lookup either.
120
121
if (lookup -> meth_offset != 0 && mp_obj_is_native_type (type )) {
121
122
if (* (void * * )((char * )type + lookup -> meth_offset ) != NULL ) {
122
- DEBUG_printf ("mp_obj_class_lookup: matched special meth slot for %s\n" , qstr_str (lookup -> attr ));
123
+ DEBUG_printf ("mp_obj_class_lookup: Matched special meth slot (off=%d) for %s\n" ,
124
+ lookup -> meth_offset , qstr_str (lookup -> attr ));
123
125
lookup -> dest [0 ] = MP_OBJ_SENTINEL ;
124
126
return ;
125
127
}
@@ -150,7 +152,8 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
150
152
#if DEBUG_PRINT
151
153
printf ("mp_obj_class_lookup: Returning: " );
152
154
mp_obj_print (lookup -> dest [0 ], PRINT_REPR ); printf (" " );
153
- mp_obj_print (lookup -> dest [1 ], PRINT_REPR ); printf ("\n" );
155
+ // Don't try to repr() lookup->dest[1], as we can be called recursively
156
+ printf ("<%s @%p>\n" , mp_obj_get_type_str (lookup -> dest [1 ]), lookup -> dest [1 ]);
154
157
#endif
155
158
return ;
156
159
}
@@ -169,6 +172,7 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
169
172
// attribute not found, keep searching base classes
170
173
171
174
if (type -> parent == NULL ) {
175
+ DEBUG_printf ("mp_obj_class_lookup: No more parents\n" );
172
176
return ;
173
177
} else if (((mp_obj_base_t * )type -> parent )-> type == & mp_type_tuple ) {
174
178
const mp_obj_tuple_t * parent_tuple = type -> parent ;
0 commit comments