parent
f41fdd05b0
commit
25f5a30e73
@ -249,7 +249,7 @@ continue2:;
|
|||||||
mp_obj_t *d = &flat_args[self->n_args - 1];
|
mp_obj_t *d = &flat_args[self->n_args - 1];
|
||||||
mp_obj_t *s = &self->extra_args[self->n_def_args - 1];
|
mp_obj_t *s = &self->extra_args[self->n_def_args - 1];
|
||||||
for (int i = self->n_def_args; i > 0; i--) {
|
for (int i = self->n_def_args; i > 0; i--) {
|
||||||
if (*d != MP_OBJ_NULL) {
|
if (*d == MP_OBJ_NULL) {
|
||||||
*d-- = *s--;
|
*d-- = *s--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
tests/basics/fun-defargs2.py
Normal file
13
tests/basics/fun-defargs2.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# 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)
|
Loading…
Reference in New Issue
Block a user