go-python / go-python/gopy

Add []error to standard types in go package

未关闭
#236 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
2.3k
派生
136
平均合并
14 分钟
30 天内合并 PR
2

描述

`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
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

标准类型在 bind/stdtypes.go 中注册;首先重现 github.com/emer/vision/vxform 的生成过程,并通过 bind/gen_slice.go 和 bind/symbols.go 跟踪 panic。确保已安装 []error,并且生成过程在没有 nil-pointer crash 的情况下完成,然后验证返回 []error 的函数能够正确绑定。

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。