Skip to content

Commit 458d09c

Browse files
committed
Properly delegates unhandled attributes to locals dict.
1 parent f5da5ea commit 458d09c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/modcamera_api.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,11 @@ static void camera_obj_property(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
408408
dest[0] = mp_obj_new_bool(mp_camera_hal_get_lenc(self));
409409
break;
410410
default:
411+
// Delegate to locals_dict
411412
dest[1] = MP_OBJ_SENTINEL;
413+
return;
412414
}
413-
} else if (dest[1] != MP_OBJ_NULL) {
415+
} else if (dest[0] == MP_OBJ_SENTINEL && dest[1] != MP_OBJ_NULL) {
414416
// Store (writing)
415417
switch (attr) {
416418
// Read-only properties
@@ -504,10 +506,10 @@ static void camera_obj_property(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
504506
mp_camera_hal_set_lenc(self, mp_obj_is_true(dest[1]));
505507
break;
506508
default:
507-
// Indicate that the attribute was not found
508-
dest[1] = MP_OBJ_SENTINEL;
509+
// Delegate to locals_dict for methods not handled here
509510
return;
510511
}
512+
// Success - indicate attribute was stored
511513
dest[0] = MP_OBJ_NULL;
512514
}
513515
}

0 commit comments

Comments
 (0)