MCPcopy Create free account
hub / github.com/goplus/py / CallMethodObject

Method CallMethodObject

object.go:271–287  ·  view source on GitHub ↗
(name string, args *Tuple)

Source from the content-addressed store, hash-verified

269}
270
271func (obj *Base) CallMethodObject(name string, args *Tuple) (*Base, error) {
272 cname := C.CString(name)
273 defer C.free(unsafe.Pointer(cname))
274
275 f := C.PyObject_GetAttrString(obj.c(), cname)
276 if f == nil {
277 return nil, AttributeError.Err(name)
278 }
279 defer C.decref(f)
280
281 if C.PyCallable_Check(f) == 0 {
282 return nil, TypeError.Err("attribute of type '%s' is not callable", name)
283 }
284
285 ret := C.PyObject_CallObject(f, args.c())
286 return obj2ObjErr(ret)
287}
288
289func (obj *Base) CallObjArgs(args ...*Base) (*Base, error) {
290 args1 := PackTuple(args...)

Callers 2

CallMethodObjArgsMethod · 0.95
CallMethodExFunction · 0.80

Calls 3

cMethod · 0.95
obj2ObjErrFunction · 0.85
ErrMethod · 0.80

Tested by

no test coverage detected