mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py: Finish implementation of all del opcodes.
At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.
This commit is contained in:
@@ -27,8 +27,14 @@ STATIC void module_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
|
||||
|
||||
STATIC bool module_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
|
||||
mp_obj_module_t *self = self_in;
|
||||
// TODO CPython allows STORE_ATTR to a module, but is this the correct implementation?
|
||||
mp_obj_dict_store(self->globals, MP_OBJ_NEW_QSTR(attr), value);
|
||||
if (value == MP_OBJ_NULL) {
|
||||
// delete attribute
|
||||
mp_obj_dict_delete(self->globals, MP_OBJ_NEW_QSTR(attr));
|
||||
} else {
|
||||
// store attribute
|
||||
// TODO CPython allows STORE_ATTR to a module, but is this the correct implementation?
|
||||
mp_obj_dict_store(self->globals, MP_OBJ_NEW_QSTR(attr), value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user