1 parent 41e2dea commit 978607aCopy full SHA for 978607a
2 files changed
py/objfun.c
@@ -299,9 +299,9 @@ continue2:;
299
// Now fill in defaults
300
mp_obj_t *d = &flat_args[self->n_args - 1];
301
mp_obj_t *s = &self->extra_args[self->n_def_args - 1];
302
- for (int i = self->n_def_args; i > 0; i--) {
+ for (int i = self->n_def_args; i > 0; i--, d--, s--) {
303
if (*d == MP_OBJ_NULL) {
304
- *d-- = *s--;
+ *d = *s;
305
}
306
307
DEBUG_printf("Args after filling defaults: ");
tests/basics/fun-defargs2.py
@@ -11,3 +11,9 @@ def foo(a, b=3):
11
12
# override with keyword
13
foo(a=2, b=333)
14
+
15
+def foo2(a=1, b=2):
16
+ print(a, b)
17
18
+# default and keyword
19
+foo2(b='two')
0 commit comments