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
c53b408f
Commit
c53b408f
authored
May 06, 2014
by
Damien George
Browse files
Merge branch 'master' of
https://github.com/micropython/micropython
Conflicts: py/argcheck.c py/objenumerate.c py/runtime.h
parents
491cbd6a
b473d0ae
Changes
4
Hide whitespace changes
Inline
Side-by-side
py/argcheck.c
View file @
c53b408f
...
...
@@ -109,3 +109,10 @@ void mp_arg_parse_all_kw_array(uint n_pos, uint n_kw, const mp_obj_t *args, uint
mp_map_init_fixed_table
(
&
kw_args
,
n_kw
,
args
+
n_pos
);
mp_arg_parse_all
(
n_pos
,
args
,
&
kw_args
,
n_allowed
,
allowed
,
out_vals
);
}
#if MICROPY_CPYTHON_COMPAT
NORETURN
void
mp_arg_error_unimpl_kw
(
void
)
{
nlr_raise
(
mp_obj_new_exception_msg
(
&
mp_type_NotImplementedError
,
"keyword argument(s) not yet implemented - use normal args instead"
));
}
#endif
py/objenumerate.c
View file @
c53b408f
...
...
@@ -48,6 +48,7 @@ STATIC const mp_arg_t enumerate_make_new_args[] = {
#define ENUMERATE_MAKE_NEW_NUM_ARGS ARRAY_SIZE(enumerate_make_new_args)
STATIC
mp_obj_t
enumerate_make_new
(
mp_obj_t
type_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
)
{
#if MICROPY_CPYTHON_COMPAT
// parse args
mp_arg_val_t
vals
[
ENUMERATE_MAKE_NEW_NUM_ARGS
];
mp_arg_parse_all_kw_array
(
n_args
,
n_kw
,
args
,
ENUMERATE_MAKE_NEW_NUM_ARGS
,
enumerate_make_new_args
,
vals
);
...
...
@@ -57,6 +58,12 @@ STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con
o
->
base
.
type
=
&
mp_type_enumerate
;
o
->
iter
=
mp_getiter
(
vals
[
0
].
u_obj
);
o
->
cur
=
vals
[
1
].
u_int
;
#else
mp_obj_enumerate_t
*
o
=
m_new_obj
(
mp_obj_enumerate_t
);
o
->
base
.
type
=
&
mp_type_enumerate
;
o
->
iter
=
mp_getiter
(
args
[
0
]);
o
->
cur
=
n_args
>
1
?
mp_obj_get_int
(
args
[
1
])
:
0
;
#endif
return
o
;
}
...
...
py/objstr.c
View file @
c53b408f
...
...
@@ -108,6 +108,12 @@ STATIC void str_print(void (*print)(void *env, const char *fmt, ...), void *env,
}
STATIC
mp_obj_t
str_make_new
(
mp_obj_t
type_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
)
{
#if MICROPY_CPYTHON_COMPAT
if
(
n_kw
!=
0
)
{
mp_arg_error_unimpl_kw
();
}
#endif
switch
(
n_args
)
{
case
0
:
return
MP_OBJ_NEW_QSTR
(
MP_QSTR_
);
...
...
@@ -146,6 +152,12 @@ STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
return
mp_const_empty_bytes
;
}
#if MICROPY_CPYTHON_COMPAT
if
(
n_kw
!=
0
)
{
mp_arg_error_unimpl_kw
();
}
#endif
if
(
MP_OBJ_IS_STR
(
args
[
0
]))
{
if
(
n_args
<
2
||
n_args
>
3
)
{
goto
wrong_args
;
...
...
py/runtime.h
View file @
c53b408f
...
...
@@ -57,6 +57,7 @@ void mp_deinit(void);
void
mp_arg_check_num
(
uint
n_args
,
uint
n_kw
,
uint
n_args_min
,
uint
n_args_max
,
bool
takes_kw
);
void
mp_arg_parse_all
(
uint
n_pos
,
const
mp_obj_t
*
pos
,
mp_map_t
*
kws
,
uint
n_allowed
,
const
mp_arg_t
*
allowed
,
mp_arg_val_t
*
out_vals
);
void
mp_arg_parse_all_kw_array
(
uint
n_pos
,
uint
n_kw
,
const
mp_obj_t
*
args
,
uint
n_allowed
,
const
mp_arg_t
*
allowed
,
mp_arg_val_t
*
out_vals
);
NORETURN
void
mp_arg_error_unimpl_kw
(
void
);
mp_obj_dict_t
*
mp_locals_get
(
void
);
void
mp_locals_set
(
mp_obj_dict_t
*
d
);
...
...
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