gopy icon indicating copy to clipboard operation
gopy copied to clipboard

leaking struct, slice, map

Open rcoreilly opened this issue 3 years ago • 2 comments

I haven't really been paying close attention to this test -- assumed it was another string formatting one that was failing -- tried to go back in time to when this test was first committed but that is not possible on modern go version.. anyway, it probably was always like this but I'm not sure :)

oreilly@mshadow:~/go/src/github.com/go-python/gopy/ > go test -run TestCStrings
2022/07/11 12:11:27 checking testbackend: "py3"...
2022/07/11 12:11:27 enabling testbackend: "py3"
2022/07/11 12:11:27 checking testbackend: "py2"...
2022/07/11 12:11:27 disabling testbackend: "py2", error: 'exec: "python2": executable file not found in $PATH'
2022/07/11 12:11:27 The following test backends are not available: py2
looping over backends: py3 in [py3]
run cmd: [build -vm=python3 -output=/var/folders/x1/r8shprmj7j71zbw3qvgl9dqc0000gq/T/gopy-3088345620 -package-prefix  ./_examples/cstrings]
github.com/go-python/gopy/_examples/cstrings

--- Processing package: github.com/go-python/gopy/_examples/cstrings ---

--- building package ---
gopy.test -test.paniconexit0 -test.timeout=10m0s -test.run=TestCStrings
goimports -w cstrings.go
go build -mod=mod -buildmode=c-shared -o cstrings_go.so .
/usr/local/bin/python3 build.py
CGO_CFLAGS=-I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -fPIC -Ofast
CGO_LDFLAGS=-L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib -lpython3.9 -ldl -framework CoreFoundation
go build -mod=mod -buildmode=c-shared -o _cstrings.cpython-39-darwin.so .
running python3 test.py
--- FAIL: TestCStrings (8.01s)
    --- FAIL: TestCStrings/py3 (8.01s)
        main_test.go:1048: [python3:_examples/cstrings]: error running python module:
            got:
            gofnString leaked:  False
            gofnStruct leaked:  True
            gofnNestedStruct leaked:  True
            gofnSlice leaked:  True
            gofnMap leaked:  True
            OK
            
            
            want:
            gofnString leaked:  False
            gofnStruct leaked:  False
            gofnNestedStruct leaked:  False
            gofnSlice leaked:  False
            gofnMap leaked:  False
            OK
            
            [python3:_examples/cstrings] diff:
            --- /var/folders/x1/r8shprmj7j71zbw3qvgl9dqc0000gq/T/gopy-3088345620/want.txt	2022-07-11 12:11:35.000000000 -0700
            +++ /var/folders/x1/r8shprmj7j71zbw3qvgl9dqc0000gq/T/gopy-3088345620/got.txt	2022-07-11 12:11:35.000000000 -0700
            @@ -1,6 +1,6 @@
             gofnString leaked:  False
            -gofnStruct leaked:  False
            -gofnNestedStruct leaked:  False
            -gofnSlice leaked:  False
            -gofnMap leaked:  False
            +gofnStruct leaked:  True
            +gofnNestedStruct leaked:  True
            +gofnSlice leaked:  True
            +gofnMap leaked:  True
             OK
            
FAIL

rcoreilly avatar Jul 11 '22 19:07 rcoreilly

I was able to confirm that it wasn't introduced by the variadic function addition, by going back to fcad870bd8df55d2290b6ace52d3119f6446e222

rcoreilly avatar Jul 11 '22 19:07 rcoreilly