Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
53775026
Commit
53775026
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:micropython/micropython
parents
fd6925b4
efc36f0c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/objarray.c
+20
-7
20 additions, 7 deletions
py/objarray.c
tests/basics/bytearray1.py
+4
-0
4 additions, 0 deletions
tests/basics/bytearray1.py
tests/basics/class-super.py
+4
-1
4 additions, 1 deletion
tests/basics/class-super.py
unix/modffi.c
+2
-2
2 additions, 2 deletions
unix/modffi.c
with
30 additions
and
10 deletions
py/objarray.c
+
20
−
7
View file @
53775026
...
...
@@ -139,6 +139,18 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
return
MP_OBJ_NOT_SUPPORTED
;
}
else
{
mp_obj_array_t
*
o
=
self_in
;
if
(
MP_OBJ_IS_TYPE
(
index_in
,
&
mp_type_slice
))
{
machine_uint_t
start
,
stop
;
if
(
!
m_seq_get_fast_slice_indexes
(
o
->
len
,
index_in
,
&
start
,
&
stop
))
{
assert
(
0
);
}
mp_obj_array_t
*
res
=
array_new
(
o
->
typecode
,
stop
-
start
);
int
sz
=
mp_binary_get_size
(
'@'
,
o
->
typecode
,
NULL
);
assert
(
sz
>
0
);
byte
*
p
=
o
->
items
;
memcpy
(
res
->
items
,
p
+
start
*
sz
,
(
stop
-
start
)
*
sz
);
return
res
;
}
else
{
uint
index
=
mp_get_index
(
o
->
base
.
type
,
o
->
len
,
index_in
,
false
);
if
(
value
==
MP_OBJ_SENTINEL
)
{
// load
...
...
@@ -150,6 +162,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
}
}
}
}
STATIC
machine_int_t
array_get_buffer
(
mp_obj_t
o_in
,
mp_buffer_info_t
*
bufinfo
,
int
flags
)
{
mp_obj_array_t
*
o
=
o_in
;
...
...
This diff is collapsed.
Click to expand it.
tests/basics/bytearray1.py
+
4
−
0
View file @
53775026
...
...
@@ -13,3 +13,7 @@ s = 0
for
i
in
a
:
s
+=
i
print
(
s
)
print
(
a
[
1
:])
print
(
a
[:
-
1
])
print
(
a
[
2
:
3
])
This diff is collapsed.
Click to expand it.
tests/basics/class-super.py
+
4
−
1
View file @
53775026
class
Base
:
def
__init__
(
self
):
self
.
a
=
1
def
meth
(
self
):
print
(
"
in Base meth
"
)
print
(
"
in Base meth
"
,
self
.
a
)
class
Sub
(
Base
):
...
...
This diff is collapsed.
Click to expand it.
unix/modffi.c
+
2
−
2
View file @
53775026
...
...
@@ -141,7 +141,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) {
mp_obj_t
iterable
=
mp_getiter
(
args
[
3
]);
mp_obj_t
item
;
int
i
=
0
;
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_
NULL
)
{
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_
STOP_ITERATION
)
{
o
->
params
[
i
++
]
=
get_ffi_type
(
item
);
}
...
...
@@ -178,7 +178,7 @@ STATIC mp_obj_t mod_ffi_callback(mp_obj_t rettype_in, mp_obj_t func_in, mp_obj_t
mp_obj_t
iterable
=
mp_getiter
(
paramtypes_in
);
mp_obj_t
item
;
int
i
=
0
;
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_
NULL
)
{
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_
STOP_ITERATION
)
{
o
->
params
[
i
++
]
=
get_ffi_type
(
item
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment