Skip to content

Commit 90afd80

Browse files
authored
Merge pull request #350 from EvanOman/fix-handleFromPtr-missing-reference
Fix `handleFromPtr` missing Reference in Maps
2 parents d520eb6 + 6079a4c commit 90afd80

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bind/gen_map.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,14 @@ otherwise parameter is a python list that we copy from
303303
g.gofile.Outdent()
304304
g.gofile.Printf("}\n")
305305
if esym.go2py != "" {
306-
g.gofile.Printf("return %s(v)%s\n", esym.go2py, esym.go2pyParenEx)
306+
// If the go2py starts with handleFromPtr_, use &v, otherwise just v
307+
val_str := ""
308+
if strings.HasPrefix(esym.go2py, "handleFromPtr_") {
309+
val_str = "&v"
310+
} else {
311+
val_str = "v"
312+
}
313+
g.gofile.Printf("return %s(%s)%s\n", esym.go2py, val_str, esym.go2pyParenEx)
307314
} else {
308315
g.gofile.Printf("return v\n")
309316
}

0 commit comments

Comments
 (0)