MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / GetAttrString

Method GetAttrString

pkg/filament/cpython/object.go:250–258  ·  view source on GitHub ↗

GetAttrString retrieves an attribute named from object the object. Returns an error if the attribute can't be fetched.

(name string)

Source from the content-addressed store, hash-verified

248
249// GetAttrString retrieves an attribute named from object the object. Returns an error if the attribute can't be fetched.
250func (ob *PyObject) GetAttrString(name string) (*PyObject, error) {
251 attr := C.CString(name)
252 defer C.free(unsafe.Pointer(attr))
253 v := C.PyObject_GetAttrString(ob.rawptr, attr)
254 if v == nil {
255 return nil, fmt.Errorf("couldn't get the %q attribute", name)
256 }
257 return &PyObject{rawptr: v}, nil
258}
259
260// HasAttr determines if the Python object has the specified attribute.
261func (ob *PyObject) HasAttr(name string) bool {

Callers 5

CallableArgCountMethod · 0.95
NewFunction · 0.80
initializeIPFnAndClassesFunction · 0.80
TestModuleRegisterFnFunction · 0.80
FetchErrFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestModuleRegisterFnFunction · 0.64