Ejemplo n.º 1
0
Archivo: call.go Proyecto: MogeiWang/py
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...)
}