Commit 0d9b0243 authored by Marius Wachtler's avatar Marius Wachtler

Generator: fix *args and **kwargs handling

parent 5e4f44b0
......@@ -43,7 +43,7 @@ static void generatorEntry(BoxedGenerator* g) {
BoxedFunction* func = g->function;
Box** args = g->args ? &g->args->elts[0] : nullptr;
callCLFunc(func->f, nullptr, func->f->num_args, func->closure, g, g->arg1, g->arg2, g->arg3, args);
callCLFunc(func->f, nullptr, func->f->numReceivedArgs(), func->closure, g, g->arg1, g->arg2, g->arg3, args);
} catch (Box* e) {
// unhandled exception: propagate the exception to the caller
g->exception = e;
......
......@@ -77,3 +77,13 @@ def G7(p):
yield a+b
return G()
print list(G7(1))
def G8(*args):
for a in args:
yield a
print list(G8(1, 2, 3, 4, 5))
def G9(**kwargs):
for a in sorted(kwargs.keys()):
yield a, kwargs[a]
print list(G9(a="1", b="2", c="3", d="4", e="5"))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment