py: Add some qstrs to the global table.
This commit is contained in:
parent
0a587b85fb
commit
7d0bfbedd2
@ -277,8 +277,8 @@ mp_obj_t mp_obj_list_sort(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
|
||||
}
|
||||
mp_obj_list_t *self = args[0];
|
||||
if (self->len > 1) {
|
||||
mp_map_elem_t *keyfun = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(QSTR_FROM_STR_STATIC("key")), MP_MAP_LOOKUP);
|
||||
mp_map_elem_t *reverse = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(QSTR_FROM_STR_STATIC("reverse")), MP_MAP_LOOKUP);
|
||||
mp_map_elem_t *keyfun = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP);
|
||||
mp_map_elem_t *reverse = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_reverse), MP_MAP_LOOKUP);
|
||||
mp_quicksort(self->items, self->items + self->len - 1,
|
||||
keyfun ? keyfun->value : NULL,
|
||||
reverse && reverse->value ? rt_is_true(reverse->value) : false);
|
||||
|
@ -239,7 +239,7 @@ static bool class_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
|
||||
|
||||
bool class_store_item(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
|
||||
mp_obj_class_t *self = self_in;
|
||||
mp_obj_t member = mp_obj_class_lookup(self->base.type, QSTR_FROM_STR_STATIC("__setitem__"));
|
||||
mp_obj_t member = mp_obj_class_lookup(self->base.type, MP_QSTR___setitem__);
|
||||
if (member != MP_OBJ_NULL) {
|
||||
mp_obj_t args[3] = {self_in, index, value};
|
||||
rt_call_function_n_kw(member, 3, 0, args);
|
||||
|
@ -17,6 +17,7 @@ Q(__repl_print__)
|
||||
Q(__bool__)
|
||||
Q(__len__)
|
||||
Q(__getitem__)
|
||||
Q(__setitem__)
|
||||
Q(__add__)
|
||||
Q(__sub__)
|
||||
|
||||
@ -96,6 +97,8 @@ Q(sort)
|
||||
Q(join)
|
||||
Q(strip)
|
||||
Q(format)
|
||||
Q(key)
|
||||
Q(reverse)
|
||||
|
||||
Q(<module>)
|
||||
Q(<lambda>)
|
||||
|
@ -968,7 +968,7 @@ mp_obj_t rt_getiter(mp_obj_t o_in) {
|
||||
} else {
|
||||
// check for __getitem__ method
|
||||
mp_obj_t dest[2];
|
||||
rt_load_method_maybe(o_in, qstr_from_str("__getitem__"), dest);
|
||||
rt_load_method_maybe(o_in, MP_QSTR___getitem__, dest);
|
||||
if (dest[0] != MP_OBJ_NULL) {
|
||||
// __getitem__ exists, create an iterator
|
||||
return mp_obj_new_getitem_iter(dest);
|
||||
|
Loading…
x
Reference in New Issue
Block a user