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
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
24ff063e
Commit
24ff063e
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Remove obsolete declarations; make mp_obj_get_array consistent.
parent
4b2b7cec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/builtin.h
+1
-3
1 addition, 3 deletions
py/builtin.h
py/builtinimport.c
+1
-1
1 addition, 1 deletion
py/builtinimport.c
py/obj.c
+18
-10
18 additions, 10 deletions
py/obj.c
py/obj.h
+2
-2
2 additions, 2 deletions
py/obj.h
with
22 additions
and
16 deletions
py/builtin.h
+
1
−
3
View file @
24ff063e
mp_obj_t
mp_builtin___import__
(
int
n_args
,
mp_obj_t
*
args
);
mp_obj_t
mp_builtin___import__
(
u
int
n_args
,
mp_obj_t
*
args
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin___build_class___obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin___import___obj
);
...
...
@@ -6,7 +6,6 @@ MP_DECLARE_CONST_FUN_OBJ(mp_builtin___repl_print___obj);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_abs_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_all_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_any_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_bytes_obj
);
// Temporary hack
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_callable_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_chr_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_dir_obj
);
...
...
@@ -30,7 +29,6 @@ MP_DECLARE_CONST_FUN_OBJ(mp_builtin_range_obj);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_repr_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_sorted_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_sum_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_builtin_str_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_namedtuple_obj
);
...
...
This diff is collapsed.
Click to expand it.
py/builtinimport.c
+
1
−
1
View file @
24ff063e
...
...
@@ -128,7 +128,7 @@ void do_load(mp_obj_t module_obj, vstr_t *file) {
rt_globals_set
(
old_globals
);
}
mp_obj_t
mp_builtin___import__
(
int
n_args
,
mp_obj_t
*
args
)
{
mp_obj_t
mp_builtin___import__
(
u
int
n_args
,
mp_obj_t
*
args
)
{
/*
printf("import:\n");
for (int i = 0; i < n_args; i++) {
...
...
This diff is collapsed.
Click to expand it.
py/obj.c
+
18
−
10
View file @
24ff063e
...
...
@@ -206,21 +206,29 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
}
#endif
mp_obj_t
*
mp_obj_get_array_fixed_n
(
mp_obj_t
o_in
,
machine_int_t
n
)
{
if
(
MP_OBJ_IS_TYPE
(
o_in
,
&
tuple_type
)
||
MP_OBJ_IS_TYPE
(
o_in
,
&
list_type
))
{
void
mp_obj_get_array
(
mp_obj_t
o
,
uint
*
len
,
mp_obj_t
**
items
)
{
if
(
MP_OBJ_IS_TYPE
(
o
,
&
tuple_type
))
{
mp_obj_tuple_get
(
o
,
len
,
items
);
}
else
if
(
MP_OBJ_IS_TYPE
(
o
,
&
list_type
))
{
mp_obj_list_get
(
o
,
len
,
items
);
}
else
{
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_TypeError
,
"object '%s' is not a tuple or list"
,
mp_obj_get_type_str
(
o
)));
}
}
void
mp_obj_get_array_fixed_n
(
mp_obj_t
o
,
uint
len
,
mp_obj_t
**
items
)
{
if
(
MP_OBJ_IS_TYPE
(
o
,
&
tuple_type
)
||
MP_OBJ_IS_TYPE
(
o
,
&
list_type
))
{
uint
seq_len
;
mp_obj_t
*
seq_items
;
if
(
MP_OBJ_IS_TYPE
(
o_in
,
&
tuple_type
))
{
mp_obj_tuple_get
(
o_in
,
&
seq_len
,
&
seq_items
);
if
(
MP_OBJ_IS_TYPE
(
o
,
&
tuple_type
))
{
mp_obj_tuple_get
(
o
,
&
seq_len
,
items
);
}
else
{
mp_obj_list_get
(
o
_in
,
&
seq_len
,
&
seq_
items
);
mp_obj_list_get
(
o
,
&
seq_len
,
items
);
}
if
(
seq_len
!=
n
)
{
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_IndexError
,
"requested length %d but object has length %d"
,
n
,
seq_len
));
if
(
seq_len
!=
le
n
)
{
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_IndexError
,
"requested length %d but object has length %d"
,
le
n
,
seq_len
));
}
return
seq_items
;
}
else
{
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_TypeError
,
"object '%s' is not a tuple or list"
,
mp_obj_get_type_str
(
o
_in
)));
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_TypeError
,
"object '%s' is not a tuple or list"
,
mp_obj_get_type_str
(
o
)));
}
}
...
...
This diff is collapsed.
Click to expand it.
py/obj.h
+
2
−
2
View file @
24ff063e
...
...
@@ -175,7 +175,6 @@ struct _mp_obj_type_t {
abs float complex
hash bool int none str
equal int str
get_array_n tuple list
unpack seq list tuple
*/
...
...
@@ -311,7 +310,8 @@ mp_float_t mp_obj_get_float(mp_obj_t self_in);
void
mp_obj_get_complex
(
mp_obj_t
self_in
,
mp_float_t
*
real
,
mp_float_t
*
imag
);
#endif
//qstr mp_obj_get_qstr(mp_obj_t arg);
mp_obj_t
*
mp_obj_get_array_fixed_n
(
mp_obj_t
o
,
machine_int_t
n
);
void
mp_obj_get_array
(
mp_obj_t
o
,
uint
*
len
,
mp_obj_t
**
items
);
void
mp_obj_get_array_fixed_n
(
mp_obj_t
o
,
uint
len
,
mp_obj_t
**
items
);
uint
mp_get_index
(
const
mp_obj_type_t
*
type
,
machine_uint_t
len
,
mp_obj_t
index
,
bool
is_slice
);
mp_obj_t
mp_obj_len_maybe
(
mp_obj_t
o_in
);
/* may return NULL */
...
...
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