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
25f5a30e
Commit
25f5a30e
authored
Mar 03, 2014
by
Damien George
Browse files
py: Fix overriding of default arguments.
Addresses issue #327.
parent
f41fdd05
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/objfun.c
View file @
25f5a30e
...
...
@@ -249,7 +249,7 @@ continue2:;
mp_obj_t
*
d
=
&
flat_args
[
self
->
n_args
-
1
];
mp_obj_t
*
s
=
&
self
->
extra_args
[
self
->
n_def_args
-
1
];
for
(
int
i
=
self
->
n_def_args
;
i
>
0
;
i
--
)
{
if
(
*
d
!
=
MP_OBJ_NULL
)
{
if
(
*
d
=
=
MP_OBJ_NULL
)
{
*
d
--
=
*
s
--
;
}
}
...
...
tests/basics/fun-defargs2.py
0 → 100644
View file @
25f5a30e
# overriding default arguments
def
foo
(
a
,
b
=
3
):
print
(
a
,
b
)
# override with positional
foo
(
1
,
333
)
# override with keyword
foo
(
1
,
b
=
333
)
# override with keyword
foo
(
a
=
2
,
b
=
333
)
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