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
eb4c37f7
Commit
eb4c37f7
authored
May 17, 2017
by
Damien George
Browse files
py/sequence: Fix boundary errors when slicing with a negative step.
parent
d007351b
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/sequence.c
View file @
eb4c37f7
...
...
@@ -88,15 +88,22 @@ bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice
if
(
start
<
0
)
{
start
=
len
+
start
;
if
(
start
<
0
)
{
start
=
0
;
if
(
indexes
->
step
<
0
)
{
start
=
-
1
;
}
else
{
start
=
0
;
}
}
}
else
if
(
indexes
->
step
>
0
&&
(
mp_uint_t
)
start
>
len
)
{
start
=
len
;
}
else
if
(
indexes
->
step
<
0
&&
(
mp_uint_t
)
start
>
len
-
1
)
{
}
else
if
(
indexes
->
step
<
0
&&
(
mp_uint_t
)
start
>
=
len
)
{
start
=
len
-
1
;
}
if
(
stop
<
0
)
{
stop
=
len
+
stop
;
if
(
stop
<
0
)
{
stop
=
-
1
;
}
if
(
indexes
->
step
<
0
)
{
stop
+=
1
;
}
...
...
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