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
47d3bd3b
Commit
47d3bd3b
authored
May 06, 2014
by
Paul Sokolovsky
Browse files
py: enumerate(): Add NotImplementedError for kwargs.
Addresses #577.
parent
33b3a690
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/argcheck.c
View file @
47d3bd3b
...
...
@@ -103,3 +103,10 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all
nlr_raise
(
mp_obj_new_exception_msg
(
&
mp_type_TypeError
,
"extra keyword arguments given"
));
}
}
#if MICROPY_CPYTHON_COMPAT
void
mp_arg_error_unimpl_kw
()
{
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 @
47d3bd3b
...
...
@@ -41,9 +41,14 @@ typedef struct _mp_obj_enumerate_t {
STATIC
mp_obj_t
enumerate_iternext
(
mp_obj_t
self_in
);
/* TODO: enumerate is one of the ones that can take args or kwargs.
Sticking to args for now */
STATIC
mp_obj_t
enumerate_make_new
(
mp_obj_t
type_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
)
{
/* TODO: enumerate is one of the ones that can take args or kwargs.
Sticking to args for now */
#if MICROPY_CPYTHON_COMPAT
if
(
n_kw
!=
0
)
{
mp_arg_error_unimpl_kw
();
}
#endif
assert
(
n_args
>
0
);
mp_obj_enumerate_t
*
o
=
m_new_obj
(
mp_obj_enumerate_t
);
o
->
base
.
type
=
&
mp_type_enumerate
;
...
...
py/runtime.h
View file @
47d3bd3b
...
...
@@ -56,6 +56,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
);
NORETURN
void
mp_arg_error_unimpl_kw
();
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