Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
03659c51
Commit
03659c51
authored
May 18, 2017
by
Damien George
Browse files
py/objrange: Fix slicing of range when step of slice is negative.
parent
e1b0f2a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objrange.c
View file @
03659c51
...
...
@@ -154,6 +154,10 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
o
->
start
=
self
->
start
+
slice
.
start
*
self
->
step
;
o
->
stop
=
self
->
start
+
slice
.
stop
*
self
->
step
;
o
->
step
=
slice
.
step
*
self
->
step
;
if
(
slice
.
step
<
0
)
{
// Negative slice steps have inclusive stop, so adjust for exclusive
o
->
stop
-=
self
->
step
;
}
return
MP_OBJ_FROM_PTR
(
o
);
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment