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 7991d39 commit 10000 3c15159Copy full SHA for 3c15159
tests/main.go
@@ -2,6 +2,7 @@ package main
2
3
import (
4
"fmt"
5
+
6
"github.com/sbinet/go-python"
7
)
8
@@ -17,4 +18,20 @@ func main() {
17
18
pystr := python.PyString_FromString(gostr)
19
str := python.PyString_AsString(pystr)
20
fmt.Println("hello [", str, "]")
21
22
+ pickle := python.PyImport_ImportModule("cPickle")
23
+ if pickle == nil {
24
+ panic("could not import 'cPickle'")
25
+ }
26
+ dumps := pickle.GetAttrString("dumps")
27
+ if dumps == nil {
28
+ panic("could not retrieve 'cPickle.dumps'")
29
30
+ out := dumps.CallFunctionObjArgs("O", pystr)
31
+ if out == nil {
32
+ panic("could not dump pystr")
33
34
+ fmt.Printf("cPickle.dumps(%s) = %q\n", gostr,
35
+ python.PyString_AsString(out),
36
+ )
37
}
0 commit comments