8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f203f28 commit 79b593fCopy full SHA for 79b593f
heap.go
@@ -0,0 +1,26 @@
1
+package python
2
+
3
+/*
4
+#include <Python.h>
5
6
+static PyObject* _gopy_InitModule(const char* nm, PyMethodDef* methods) {
7
+ return Py_InitModule(nm, methods);
8
+}
9
+*/
10
+import "C"
11
+import (
12
+ "errors"
13
+ "unsafe"
14
+)
15
16
+func Py_InitModule(name string) (*PyObject, error) {
17
+ c_mname := C.CString(name)
18
+ defer C.free(unsafe.Pointer(c_mname))
19
+ obj := togo(C._gopy_InitModule(c_mname, nil))
20
+ if obj == nil {
21
+ return nil, errors.New("python: internal error; module creation failed.")
22
+ }
23
+ return obj, nil
24
25
26
+// EOF
0 commit comments