go-python / go-python/gopy

leaking struct, slice, map

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

描述

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/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -fPIC -Ofast
CGO_LDFLAGS=-L/opt/homebrew/opt/python@3.9/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
```

贡献指南

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

调研方向

使用 `go test -run TestCStrings` 重现失败,并检查 `_examples/cstrings` 和 `main_test.go:1048`。将 struct、nested-struct、slice 和 map 的情况与预期输出进行比较;当 TestCStrings 在可用的 Python backend 中针对每个泄漏报告 `False` 时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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