summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-04 01:34:23 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-04 02:35:49 +0200
commite606cb656165aff2424fb6ca45f09d606246d073 (patch)
tree3e5faf764640b0b063ad2ca41482f42490b99dd5 /py/objstr.c
parent26534cec8510323e8d1a313991b76320821c666b (diff)
downloadmicropython-e606cb656165aff2424fb6ca45f09d606246d073.tar.gz
micropython-e606cb656165aff2424fb6ca45f09d606246d073.zip
slice: Allow building with MICROPY_ENABLE_SLICE=0.
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 54dd087a45..8e3e9d9025 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -35,6 +35,7 @@ mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
if (MP_OBJ_IS_SMALL_INT(rhs_in)) {
// TODO: This implements byte string access for single index so far
return mp_obj_new_int(lhs_str[mp_obj_get_int(rhs_in)]);
+#if MICROPY_ENABLE_SLICE
} else if (MP_OBJ_IS_TYPE(rhs_in, &slice_type)) {
int start, stop, step;
mp_obj_slice_get(rhs_in, &start, &stop, &step);
@@ -47,6 +48,7 @@ mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
stop = len + stop;
}
return mp_obj_new_str(qstr_from_strn_copy(lhs_str + start, stop - start));
+#endif
} else {
// Throw TypeError here
assert(0);