Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ea2509d9
Commit
ea2509d9
authored
Feb 02, 2014
by
Paul Sokolovsky
Browse files
Fix assert() usage.
parent
6964422c
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/objlist.c
View file @
ea2509d9
...
...
@@ -139,7 +139,9 @@ static mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
#if MICROPY_ENABLE_SLICE
if
(
MP_OBJ_IS_TYPE
(
rhs
,
&
slice_type
))
{
machine_uint_t
start
,
stop
;
assert
(
m_seq_get_fast_slice_indexes
(
o
->
len
,
rhs
,
&
start
,
&
stop
));
if
(
!
m_seq_get_fast_slice_indexes
(
o
->
len
,
rhs
,
&
start
,
&
stop
))
{
assert
(
0
);
}
mp_obj_list_t
*
res
=
list_new
(
stop
-
start
);
m_seq_copy
(
res
->
items
,
o
->
items
+
start
,
res
->
len
,
mp_obj_t
);
return
res
;
...
...
py/objstr.c
View file @
ea2509d9
...
...
@@ -116,7 +116,9 @@ mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
#if MICROPY_ENABLE_SLICE
}
else
if
(
MP_OBJ_IS_TYPE
(
rhs_in
,
&
slice_type
))
{
machine_uint_t
start
,
stop
;
assert
(
m_seq_get_fast_slice_indexes
(
lhs_len
,
rhs_in
,
&
start
,
&
stop
));
if
(
!
m_seq_get_fast_slice_indexes
(
lhs_len
,
rhs_in
,
&
start
,
&
stop
))
{
assert
(
0
);
}
return
mp_obj_new_str
(
lhs_data
+
start
,
stop
-
start
,
false
);
#endif
}
else
{
...
...
py/objtuple.c
View file @
ea2509d9
...
...
@@ -91,7 +91,9 @@ static mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
#if MICROPY_ENABLE_SLICE
if
(
MP_OBJ_IS_TYPE
(
rhs
,
&
slice_type
))
{
machine_uint_t
start
,
stop
;
assert
(
m_seq_get_fast_slice_indexes
(
o
->
len
,
rhs
,
&
start
,
&
stop
));
if
(
!
m_seq_get_fast_slice_indexes
(
o
->
len
,
rhs
,
&
start
,
&
stop
))
{
assert
(
0
);
}
mp_obj_tuple_t
*
res
=
mp_obj_new_tuple
(
stop
-
start
,
NULL
);
m_seq_copy
(
res
->
items
,
o
->
items
+
start
,
res
->
len
,
mp_obj_t
);
return
res
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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