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

Error related to gopyh on Python 3.5.2 #228

Closed kushaldas closed 4 years ago

kushaldas commented 4 years ago

The system is Ubuntu Xenial, Python 3.5.2, go version go1.14.2 linux/amd64

$ gopy pkg --output=internal --vm=/usr/bin/python3 github.com/kushaldas/maybefasterapi/pkg/fasterapi

--- Processing package: github.com/kushaldas/maybefasterapi/pkg/fasterapi ---
ignoring python incompatible method: time.func (time.Time).Date() (year int, month time.Month, day int): func() (year int, month time.Month, day int): gopy: too many results to return: func() (year int, month time.Month, day int)
ignoring python incompatible method: time.func (time.Time).ISOWeek() (year int, week int): func() (year int, week int): gopy: second result value must be of type error: func() (year int, week int)
ignoring python incompatible method: time.func (time.Time).Clock() (hour int, min int, sec int): func() (hour int, min int, sec int): gopy: too many results to return: func() (hour int, min int, sec int)
ignoring python incompatible method: time.func (time.Time).Zone() (name string, offset int): func() (name string, offset int): gopy: second result value must be of type error: func() (name string, offset int)

--- building package ---
gopy pkg --output=internal --vm=/usr/bin/python3 github.com/kushaldas/maybefasterapi/pkg/fasterapi
goimports -w fasterapi.go
go build -buildmode=c-shared -o fasterapi_go.so .
cmd had error: exit status 2  output:
# github.com/kushaldas/maybefasterapi/internal/fasterapi
./fasterapi.go:89:2: undefined: gopyh.DecRef
./fasterapi.go:95:2: undefined: gopyh.IncRef
./fasterapi.go:101:9: undefined: gopyh.NumHandles

2020/04/21 08:36:25 error dispatching command: exit status 2
maximk commented 4 years ago

Apparently, the master branch is not working. Switching to 'v0.3.1' seems to fix the issue. I had also to upgrade x/tools reference in go.mod to avoid 'nil Pkg importing' error.