go-python / gopy

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

Adds missing pointer reference for slices along with test #351

Closed EvanOman closed 6 months ago

EvanOman commented 6 months ago

Fixes #346

NOTE: The variadic test was failing for me before adding this test:

Click me ``` run cmd: [build -vm=python3 -output=/tmp/gopy-3250023487 -package-prefix ./_examples/variadic] go build -v ./_examples/variadic --- Processing package: github.com/go-python/gopy/_examples/variadic --- --- building package --- gopy.test -test.paniconexit0 -test.timeout=10m0s goimports -w variadic.go go build -mod=mod -buildmode=c-shared -o variadic_go.so . /home/evan/miniconda3/bin/python3 build.py CGO_CFLAGS="-I/home/evan/miniconda3/include/python3.10" -fPIC -Ofast CGO_LDFLAGS="-L/home/evan/miniconda3/lib" "-lpython3.10" -lcrypt -lpthread -ldl -lutil -lm -lm go build -mod=mod -buildmode=c-shared -o _variadic.cpython-310-x86_64-linux-gnu.so . running python3 test.py FAIL exit status 1 FAIL github.com/go-python/gopy 123.954s ```

Is that test flaky for other people too?

However I did confirm that the new test I added failed before the fix and passed afterwards.

rcoreilly commented 6 months ago

Giving this a try now.

rcoreilly commented 6 months ago

looks like it works -- not sure how I missed the test before. Need to fix the CI testing here too someday. just had to run format on your slices.go file.