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

Method SetAttrString

pkg/filament/cpython/object.go:239–247  ·  view source on GitHub ↗

SetAttrString set the value of the attribute provided for this object to the specified value.

(name string, value *C.PyObject)

Source from the content-addressed store, hash-verified

237
238// SetAttrString set the value of the attribute provided for this object to the specified value.
239func (ob *PyObject) SetAttrString(name string, value *C.PyObject) error {
240 attr := C.CString(name)
241 defer C.free(unsafe.Pointer(attr))
242 err := int(C.PyObject_SetAttrString(ob.rawptr, attr, value))
243 if err == -1 {
244 return fmt.Errorf("couldn't set the value of the %q attribute", name)
245 }
246 return nil
247}
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) {

Callers 1

RegisterFnMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected