hpy_tests._vendored.debug.test_handles_leak:test_leak_from_method
compiler = <_vendored.support.ExtensionCompiler object at 0x00007fc9f2bdbe88>
def test_leak_from_method(compiler):
from hpy.universal import _debug
mod = compiler.make_module("""
HPyDef_METH(Dummy_leak, "leak", HPyFunc_O)
static HPy Dummy_leak_impl(HPyContext *ctx, HPy self, HPy arg) {
HPy_Dup(ctx, arg); // leak!
return HPy_Dup(ctx, ctx->h_None);
}
static HPyDef *Dummy_defines[] = {
&Dummy_leak,
NULL
};
static HPyType_Spec Dummy_spec = {
.name = "mytest.Dummy",
.defines = Dummy_defines,
};
@EXPORT_TYPE("Dummy", Dummy_spec)
@INIT
""")
gen = _debug.new_generation()
obj = mod.Dummy()
obj.leak("a")
leaks = [dh.obj for dh in _debug.get_open_handles(gen)]
> assert leaks == ["a"]
E AssertionError: assert [] == ['a']
E Right contains one more item: 'a'
E Use -v to get the full diff
../build/extra_tests/hpy_tests/_vendored/debug/test_handles_leak.py:97: AssertionError
builder: pypy-c-jit-macos-x86-64 build #1395+
test: hpy_tests._vendored.debug.test_handles_leak:test_leak_from_method