We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python
class Some: def thing(what): print(what)
nim
when isMainModule: let m = pyimport("test") oname = "Some" fname = "thing" o = m.getattr(oname) f = o.getattr(fname) f(what="nice")
Modified dotCall macro to make it work:
dotCall
macro fnCall(o: untyped, args: varargs[untyped]): untyped = let plainArgs = newTree(nnkBracket) let kwArgs = newTree(nnkBracket) for arg in args: # Skip the bogus [] `args` when no argument is passed if arg.kind == nnkHiddenStdConv and arg[0].kind == nnkEmpty: continue elif arg.kind != nnkExprEqExpr: plainArgs.add(newCall("toPyObjectArgument", arg)) else: expectKind(arg[0], nnkIdent) kwArgs.add(newTree(nnkPar, newCall("cstring", newLit($arg[0])), newCall("toPyObjectArgument", arg[1]))) result = newCall(bindSym"newPyObjectConsumingRef", newCall(bindSym"callObjectAux", newcall("privateRawPyObj", o), plainArgs, kwArgs)) template `()`*(o: PyObject, args: varargs[untyped]): PyObject = fnCall(o, args)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
python
nim
Modified
dotCall
macro to make it work:The text was updated successfully, but these errors were encountered: