memory/gc/test/test_rawrefcount.py::TestRawRefCount::()::test_pyobject_dies[False-True]
self = <rpython.memory.gc.test.test_rawrefcount.TestRawRefCount object at 0x0000023c80b30090>
old = False, external = True
@py.test.mark.parametrize('old,external', [
(False, False), (True, False), (False, True)])
def test_pyobject_dies(self, old, external):
p1, p1ref, r1, r1addr, check_alive = (
self._rawrefcount_pair(42, is_pyobj=True, create_old=old,
> force_external=external))
memory\gc\test\test_rawrefcount.py:260:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.memory.gc.test.test_rawrefcount.TestRawRefCount object at 0x0000023c80b30090>
intval = 42, is_light = False, is_pyobj = True, create_old = False
create_immortal = False, force_external = True
def _rawrefcount_pair(self, intval, is_light=False, is_pyobj=False,
create_old=False, create_immortal=False,
force_external=False):
if is_light:
rc = REFCNT_FROM_PYPY_LIGHT
else:
rc = REFCNT_FROM_PYPY
self.trigger = []
self.gc.rawrefcount_init(lambda: self.trigger.append(1))
#
if create_immortal:
p1 = lltype.malloc(S, immortal=True)
else:
saved = self.gc.nonlarge_max
try:
if force_external:
self.gc.nonlarge_max = 1
p1 = self.malloc(S)
finally:
self.gc.nonlarge_max = saved
p1.x = intval
if create_immortal:
self.consider_constant(p1)
elif create_old:
self.stackroots.append(p1)
self._collect(major=False)
p1 = self.stackroots.pop()
p1ref = lltype.cast_opaque_ptr(llmemory.GCREF, p1)
# r1 points at ob_refcnt; the ob_pypy_link prefix is reserved before it
r1 = rawrefcount._pyobject_alloc(immortal=create_immortal)
r1.c_ob_refcnt = rc
r1addr = llmemory.cast_ptr_to_adr(r1)
if is_pyobj:
assert not is_light
self.gc.rawrefcount_create_link_pyobj(p1ref, r1addr)
else:
self.gc.rawrefcount_create_link_pypy(p1ref, r1addr)
assert r1.c_ob_refcnt == rc
> assert rawrefcount._ob_link_get(r1) != 0
E assert 0 != 0
E + where 0 = <function _ob_link_get at 0x0000023c90e75808>(<* <C object Struct PyObjectS { c_ob_refcnt, c_ob_type } at 0x23c923be1c0>>)
E + where <function _ob_link_get at 0x0000023c90e75808> = <function _ob_link_get at 0x0000023c90e75808>
E + where <function _ob_link_get at 0x0000023c90e75808> = rawrefcount._ob_link_get
memory\gc\test\test_rawrefcount.py:75: AssertionError
builder: rpython-win-x86-64 build #764*
test: memory/gc/test/test_rawrefcount.py::TestRawRefCount::()::test_pyobject_dies[False-True]