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

Function NewGoModule

gomodule.go:15–35  ·  view source on GitHub ↗
(name string, doc string, self interface{})

Source from the content-addressed store, hash-verified

13}
14
15func NewGoModule(name string, doc string, self interface{}) (mod GoModule, err error) {
16
17 cName := C.CString(name)
18 defer C.free(unsafe.Pointer(cName))
19
20 var mdoc *C.char
21 if doc != "" {
22 mdoc = C.CString(doc)
23 defer C.free(unsafe.Pointer(mdoc))
24 }
25
26 m := C.Py_InitModule4(cName, nil, mdoc, nil, C.PYTHON_API_VERSION)
27 if m == nil {
28 err = exception()
29 return
30 }
31
32 mod.Module = (*Module)(unsafe.Pointer(m))
33 mod.Ctx = Register(mod.Module.Dict(), name + ".", self)
34 return
35}
36
37// ------------------------------------------------------------------------------------------
38

Callers 1

TestGoModuleFunction · 0.85

Calls 3

exceptionFunction · 0.85
RegisterFunction · 0.85
DictMethod · 0.80

Tested by 1

TestGoModuleFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…