go-python / gopy

gopy generates a CPython extension module from a go package.
BSD 3-Clause "New" or "Revised" License
2.05k stars 113 forks source link

Add []error to standard types in go package #236

Open rcoreilly opened 4 years ago

rcoreilly commented 4 years ago

bind/stdtypes.go installs the basic builtin types, and Slice_ versions of these. It does not currently install an []error slice, but it should -- otherwise functions returning this end up binding to the wrong version of it somehow. I tried adding it but there was a crash during generation. Need to figure this out:

--- Processing package: github.com/emer/vision/vxform ---
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1246fa7]

goroutine 1 [running]:
go/types.(*Package).Name(...)
    /usr/local/Cellar/go/1.15.2/libexec/src/go/types/package.go:34
github.com/go-python/gopy/bind.(*symbol).pyPkgId(0xc0000d51d0, 0xc0000bb2c0, 0x2d, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/symbols.go:361 +0x47
github.com/go-python/gopy/bind.(*pyGen).genSliceInit(0xc002623a40, 0xc0000dc960, 0x0, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen_slice.go:191 +0x55eb
github.com/go-python/gopy/bind.(*pyGen).genSlice(0xc002623a40, 0xc0000dc960, 0xc0000a0000, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen_slice.go:53 +0x3fb
github.com/go-python/gopy/bind.(*pyGen).genType(0xc002623a40, 0xc0000dc960, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen_type.go:51 +0x1c5
github.com/go-python/gopy/bind.(*pyGen).genGoPkg(0xc002623a40)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen.go:854 +0x208
github.com/go-python/gopy/bind.(*pyGen).genPkg(0xc002623a40, 0xc0000d8000)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen.go:603 +0x105
github.com/go-python/gopy/bind.(*pyGen).gen(0xc002623a40, 0xc002623a40, 0x1341ef0)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen.go:524 +0xc5
github.com/go-python/gopy/bind.GenPyBind(0x13338b7, 0x3, 0xc0000b64b0, 0x28, 0xc0000b47f8, 0x6, 0xc0000fa000, 0x373, 0xc002ecfd60, 0x16, ...)
    /Users/oreilly/go/src/github.com/go-python/gopy/bind/gen.go:482 +0x1b4
main.genPkg(0x13338b7, 0x3, 0xc0000b64b0, 0x28, 0xc0000b47f8, 0x6, 0xc0000fa000, 0x373, 0xc002ecfd60, 0x16, ...)
    /Users/oreilly/go/src/github.com/go-python/gopy/gen.go:81 +0x1a6
main.runBuild(0x13338b7, 0x3, 0xc0000b64b0, 0x28, 0xc0000b47f8, 0x6, 0xc0000fa000, 0x373, 0xc0000b4800, 0x7, ...)
    /Users/oreilly/go/src/github.com/go-python/gopy/cmd_build.go:100 +0x130
main.gopyRunCmdExe(0xc0000c4900, 0xc0000b8070, 0x1c, 0x1d, 0x0, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/cmd_exe.go:137 +0xe31
github.com/gonuts/commander.(*Command).Dispatch(0xc0000c4900, 0xc0000b8020, 0x21, 0x22, 0x0, 0x0)
    /Users/oreilly/go/src/github.com/gonuts/commander/commands.go:221 +0x246
github.com/gonuts/commander.(*Command).Dispatch(0xc0000c4a20, 0xc0000b8010, 0x22, 0x23, 0x0, 0x0)
    /Users/oreilly/go/src/github.com/gonuts/commander/commands.go:187 +0x139
main.run(0xc0000b8010, 0x22, 0x23, 0x0, 0x0)
    /Users/oreilly/go/src/github.com/go-python/gopy/main.go:37 +0x27c
main.main()
    /Users/oreilly/go/src/github.com/go-python/gopy/main.go:45 +0x76
make: *** [gen] Error 2