Merge pull request #338 from richecr/fix/__next__

fix __next__ function
This commit is contained in:
Randall O'Reilly 2023-12-12 11:47:07 -08:00 committed by GitHub
commit 2dc64b7f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -246,7 +246,11 @@ otherwise parameter is a python list that we copy from
g.pywrap.Indent()
g.pywrap.Printf("if self.index < len(self):\n")
g.pywrap.Indent()
g.pywrap.Printf("rv = _%s_elem(self.handle, self.index)\n", qNm)
if esym.hasHandle() {
g.pywrap.Printf("rv = %s(handle=_%s_elem(self.handle, self.index))\n", esym.pyPkgId(slc.gopkg), qNm)
} else {
g.pywrap.Printf("rv = _%s_elem(self.handle, self.index)\n", qNm)
}
g.pywrap.Println("self.index = self.index + 1")
g.pywrap.Println("return rv")
g.pywrap.Outdent()

View File

@ -593,7 +593,7 @@ slices.IntSum from Python list: 10
slices.IntSum from Go slice: 10
unsigned slice elements: 1 2 3 4
signed slice elements: -1 -2 -3 -4
struct slice: slices.Slice_Ptr_slices_S len: 3 handle: 11 [12, 13, 14]
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}]
struct slice[0]: slices.S{Name=S0, handle=15}
struct slice[1]: slices.S{Name=S1, handle=16}
struct slice[2].Name: S2