Skip to content

Commit 2dc64b7

Browse files
authored
Merge pull request #338 from richecr/fix/__next__
fix __next__ function
2 parents ba7e45b + 8eddf46 commit 2dc64b7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bind/gen_slice.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ otherwise parameter is a python list that we copy from
246246
g.pywrap.Indent()
247247
g.pywrap.Printf("if self.index < len(self):\n")
248248
g.pywrap.Indent()
249-
g.pywrap.Printf("rv = _%s_elem(self.handle, self.index)\n", qNm)
249+
if esym.hasHandle() {
250+
g.pywrap.Printf("rv = %s(handle=_%s_elem(self.handle, self.index))\n", esym.pyPkgId(slc.gopkg), qNm)
251+
} else {
252+
g.pywrap.Printf("rv = _%s_elem(self.handle, self.index)\n", qNm)
253+
}
250254
g.pywrap.Println("self.index = self.index + 1")
251255
g.pywrap.Println("return rv")
252256
g.pywrap.Outdent()

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ slices.IntSum from Python list: 10
593593
slices.IntSum from Go slice: 10
594594
unsigned slice elements: 1 2 3 4
595595
signed slice elements: -1 -2 -3 -4
596-
struct slice: slices.Slice_Ptr_slices_S len: 3 handle: 11 [12, 13, 14]
596+
struct slice: slices.Slice_Ptr_slices_S len: 3 handle: 11 [slices.S{Name=S0, handle=12}, slices.S{Name=S1, handle=13}, slices.S{Name=S2, handle=14}]
597597
struct slice[0]: slices.S{Name=S0, handle=15}
598598
struct slice[1]: slices.S{Name=S1, handle=16}
599599
struct slice[2].Name: S2

0 commit comments

Comments
 (0)