mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
py/objslice: Inline fetching of slice paramters in str_subscr().
To reduce code size.
This commit is contained in:
committed by
Damien George
parent
4c93955b7b
commit
10709846f3
@@ -184,7 +184,11 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
|
||||
#if MICROPY_PY_BUILTINS_SLICE
|
||||
if (mp_obj_is_type(index, &mp_type_slice)) {
|
||||
mp_obj_t ostart, ostop, ostep;
|
||||
mp_obj_slice_get(index, &ostart, &ostop, &ostep);
|
||||
mp_obj_slice_t *slice = MP_OBJ_TO_PTR(index);
|
||||
ostart = slice->start;
|
||||
ostop = slice->stop;
|
||||
ostep = slice->step;
|
||||
|
||||
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
|
||||
mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user