diff options
author | Nicko van Someren <nicko@nicko.org> | 2019-11-20 18:53:07 -0700 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-12-29 00:06:02 +1100 |
commit | 10709846f38f8f6519dee27694ce583926a00cb9 (patch) | |
tree | 0a04b68f5d7dc440bcc7b41f763cda21912ab100 /py/objstrunicode.c | |
parent | 4c93955b7b4d3d860aed1551ca6231ac4e388e69 (diff) |
py/objslice: Inline fetching of slice paramters in str_subscr().
To reduce code size.
Diffstat (limited to 'py/objstrunicode.c')
-rw-r--r-- | py/objstrunicode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/py/objstrunicode.c b/py/objstrunicode.c index 78d0b5006..5a127243b 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -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"); } |