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
47d3bd3b
Commit
47d3bd3b
authored
11 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
py: enumerate(): Add NotImplementedError for kwargs.
Addresses #577.
parent
33b3a690
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/argcheck.c
+7
-0
7 additions, 0 deletions
py/argcheck.c
py/objenumerate.c
+7
-2
7 additions, 2 deletions
py/objenumerate.c
py/runtime.h
+1
-0
1 addition, 0 deletions
py/runtime.h
with
15 additions
and
2 deletions
py/argcheck.c
+
7
−
0
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
...
@@ -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"
));
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
This diff is collapsed.
Click to expand it.
py/objenumerate.c
+
7
−
2
View file @
47d3bd3b
...
@@ -41,9 +41,14 @@ typedef struct _mp_obj_enumerate_t {
...
@@ -41,9 +41,14 @@ typedef struct _mp_obj_enumerate_t {
STATIC
mp_obj_t
enumerate_iternext
(
mp_obj_t
self_in
);
STATIC
mp_obj_t
enumerate_iternext
(
mp_obj_t
self_in
);
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.
/* TODO: enumerate is one of the ones that can take args or kwargs.
Sticking to args for now */
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
)
{
#if MICROPY_CPYTHON_COMPAT
if
(
n_kw
!=
0
)
{
mp_arg_error_unimpl_kw
();
}
#endif
assert
(
n_args
>
0
);
assert
(
n_args
>
0
);
mp_obj_enumerate_t
*
o
=
m_new_obj
(
mp_obj_enumerate_t
);
mp_obj_enumerate_t
*
o
=
m_new_obj
(
mp_obj_enumerate_t
);
o
->
base
.
type
=
&
mp_type_enumerate
;
o
->
base
.
type
=
&
mp_type_enumerate
;
...
...
This diff is collapsed.
Click to expand it.
py/runtime.h
+
1
−
0
View file @
47d3bd3b
...
@@ -56,6 +56,7 @@ void mp_deinit(void);
...
@@ -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_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
(
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
);
mp_obj_dict_t
*
mp_locals_get
(
void
);
void
mp_locals_set
(
mp_obj_dict_t
*
d
);
void
mp_locals_set
(
mp_obj_dict_t
*
d
);
...
...
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