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

Method AddObject

module.go:94–108  ·  view source on GitHub ↗
(name string, obj *Base)

Source from the content-addressed store, hash-verified

92}
93
94func (mod *Module) AddObject(name string, obj *Base) error {
95 if obj == nil {
96 return AssertionError.Err("ValueError: obj == nil!")
97 }
98
99 cname := C.CString(name)
100 defer C.free(unsafe.Pointer(cname))
101
102 ret := C.PyModule_AddObject(mod.c(), cname, obj.c())
103 if ret < 0 {
104 return exception()
105 }
106
107 return nil
108}
109
110func (mod *Module) AddIntConstant(name string, value int) error {
111 cname := C.CString(name)

Callers

nothing calls this directly

Calls 3

exceptionFunction · 0.85
ErrMethod · 0.80
cMethod · 0.80

Tested by

no test coverage detected