mirror of https://github.com/go-python/gopy.git
bind: test buffer protocol
Change-Id: I41744bf84a6dc87ee8a372e490068465c248ddd1
This commit is contained in:
parent
8b429c382b
commit
806eaacb48
|
@ -157,6 +157,7 @@ except Exception, err:
|
||||||
arr[1] = 42
|
arr[1] = 42
|
||||||
print "arr:",arr
|
print "arr:",arr
|
||||||
print "len(arr):",len(arr)
|
print "len(arr):",len(arr)
|
||||||
|
print "mem(arr):",len(memoryview(arr))
|
||||||
|
|
||||||
print "--- testing slice..."
|
print "--- testing slice..."
|
||||||
s = hi.GetIntSlice()
|
s = hi.GetIntSlice()
|
||||||
|
@ -173,4 +174,5 @@ except Exception, err:
|
||||||
s[1] = 42
|
s[1] = 42
|
||||||
print "slice:",s
|
print "slice:",s
|
||||||
print "len(slice):",len(s)
|
print "len(slice):",len(s)
|
||||||
|
print "mem(slice):",len(memoryview(s))
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@ arr[1]: 2
|
||||||
arr[2]: caught: array index out of range
|
arr[2]: caught: array index out of range
|
||||||
arr: [2]int{1, 42}
|
arr: [2]int{1, 42}
|
||||||
len(arr): 2
|
len(arr): 2
|
||||||
|
mem(arr): 2
|
||||||
--- testing slice...
|
--- testing slice...
|
||||||
slice: []int{1, 2}
|
slice: []int{1, 2}
|
||||||
len(slice): 2
|
len(slice): 2
|
||||||
|
@ -153,6 +154,7 @@ slice[1]: 2
|
||||||
slice[2]: caught: array index out of range
|
slice[2]: caught: array index out of range
|
||||||
slice: []int{1, 42}
|
slice: []int{1, 42}
|
||||||
len(slice): 2
|
len(slice): 2
|
||||||
|
mem(slice): 2
|
||||||
`)
|
`)
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
cmd = exec.Command("python2", "./test.py")
|
cmd = exec.Command("python2", "./test.py")
|
||||||
|
|
Loading…
Reference in New Issue