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
035deae1
Commit
035deae1
authored
Jul 02, 2015
by
Damien George
Browse files
py/objarray.c: Allow to build with debugging and bytearray but no array.
parent
5161239c
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objarray.c
View file @
035deae1
...
...
@@ -130,7 +130,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
&&
typecode
==
BYTEARRAY_TYPECODE
)
||
(
MICROPY_PY_ARRAY
&&
(
MP_OBJ_IS_TYPE
(
initializer
,
&
mp_type_bytes
)
||
MP_OBJ_IS_TYPE
(
initializer
,
&
mp_type_bytearray
))))
||
(
MICROPY_PY_BUILTINS_BYTEARRAY
&&
MP_OBJ_IS_TYPE
(
initializer
,
&
mp_type_bytearray
))))
)
&&
mp_get_buffer
(
initializer
,
&
bufinfo
,
MP_BUFFER_READ
))
{
// construct array from raw bytes
// we round-down the len to make it a multiple of sz (CPython raises error)
...
...
@@ -301,7 +301,8 @@ STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
STATIC
mp_obj_t
array_append
(
mp_obj_t
self_in
,
mp_obj_t
arg
)
{
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
assert
(
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_array
)
||
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_bytearray
));
assert
((
MICROPY_PY_BUILTINS_BYTEARRAY
&&
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_bytearray
))
||
(
MICROPY_PY_ARRAY
&&
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_array
)));
mp_obj_array_t
*
self
=
self_in
;
if
(
self
->
free
==
0
)
{
...
...
@@ -319,7 +320,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_append_obj, array_append);
STATIC
mp_obj_t
array_extend
(
mp_obj_t
self_in
,
mp_obj_t
arg_in
)
{
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
assert
(
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_array
)
||
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_bytearray
));
assert
((
MICROPY_PY_BUILTINS_BYTEARRAY
&&
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_bytearray
))
||
(
MICROPY_PY_ARRAY
&&
MP_OBJ_IS_TYPE
(
self_in
,
&
mp_type_array
)));
mp_obj_array_t
*
self
=
self_in
;
// allow to extend by anything that has the buffer protocol (extension to CPython)
...
...
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