func CallMethodEx(cfg *Config, self *py.Base, method string, args ...interface{}) (ret *py.Base, err error) { args1, err := PackEx(cfg, args...) if err != nil { err = errors.Info(syscall.EINVAL, "pyutil.Call").Detail(err) return } defer args1.Decref() return self.CallMethodObject(method, args1) }
func CallEx(cfg *Config, fn *py.Base, args ...interface{}) (ret *py.Base, err error) { args1, err := PackEx(cfg, args...) if err != nil { err = errors.Info(syscall.EINVAL, "pyutil.Call").Detail(err) return } defer args1.Decref() return fn.CallObject(args1) }
func NewEx(cfg *Config, mod *py.Base, clsname string, args ...interface{}) (ret *py.Base, err error) { o, err := mod.GetAttrString(clsname) if err != nil { err = errors.Info(err, "pyutil.New", clsname).Detail(err) return } defer o.Decref() ty, ok := py.AsClass(o) if !ok { err = errors.Info(syscall.EINVAL, "pyutil.New", o.String(), "is not a class") return } return NewInstanceEx(cfg, ty, args...) }