Open pvcnt opened 1 day ago
It looks like it is impossible to call a function with named arguments. While g(1) works well, g(x=1) results in an error.
g(1)
g(x=1)
Given the following snippet:
import starlark as sl glb = sl.Globals.standard() mod = sl.Module() def g(x): print(f"g called with {x}") return 2 * x mod.add_callable("g", g) ast = sl.parse("a.star", "g(x=1)") def load(name): raise FileNotFoundError(name) sl.eval(mod, ast, glb, sl.FileLoader(load))
I obtain the following error:
error: Found `x` extra named parameter(s) for call to function
Yep, not currently implemented:
https://github.com/inducer/starlark-pyo3/blob/00f5fe7e6c8a639d31e88e9046bdb4a20815a397/src/lib.rs#L622-L641
Help welcome.
It looks like it is impossible to call a function with named arguments. While
g(1)
works well,g(x=1)
results in an error.How to reproduce
Given the following snippet:
I obtain the following error: