Author: Armin Rigo <[email protected]>
Branch: cpyext-gc-support
Changeset: r80404:6b72484e261b
Date: 2015-10-23 11:23 +0200
http://bitbucket.org/pypy/pypy/changeset/6b72484e261b/
Log: Randomly try to avoid getting errors when we see frees from older
tests occurring in this test. Really that's just "hack hack hack".
diff --git a/pypy/module/cpyext/test/test_api.py
b/pypy/module/cpyext/test/test_api.py
--- a/pypy/module/cpyext/test/test_api.py
+++ b/pypy/module/cpyext/test/test_api.py
@@ -6,6 +6,7 @@
from pypy.module.cpyext.test.test_cpyext import freeze_refcnts,
LeakCheckingTest
PyObject = api.PyObject
from pypy.interpreter.error import OperationError
+from rpython.rlib import rawrefcount
import os
@api.cpython_api([PyObject], lltype.Void)
@@ -36,6 +37,9 @@
cls.api = CAPI()
CAPI.__dict__.update(api.INTERPLEVEL_API)
+ print 'DONT_FREE_ANY_MORE'
+ rawrefcount._dont_free_any_more()
+
def raises(self, space, api, expected_exc, f, *args):
if not callable(f):
raise Exception("%s is not callable" % (f,))
diff --git a/pypy/module/cpyext/test/test_cpyext.py
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -18,7 +18,6 @@
from pypy.module.cpyext.pyobject import Py_DecRef
from rpython.tool.identity_dict import identity_dict
from rpython.tool import leakfinder
-from rpython.rlib import rawrefcount
def setup_module(module):
diff --git a/rpython/rlib/rawrefcount.py b/rpython/rlib/rawrefcount.py
--- a/rpython/rlib/rawrefcount.py
+++ b/rpython/rlib/rawrefcount.py
@@ -135,6 +135,12 @@
for ob, wr in wr_o_list:
attach(ob, wr, _o_list)
+_keepalive_forever = set()
+def _dont_free_any_more():
+ "Make sure that any object still referenced won't be freed any more."
+ for ob in _p_list + _o_list:
+ _keepalive_forever.add(to_obj(object, ob))
+
# ____________________________________________________________
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -569,7 +569,7 @@
raise Exception("internal ll2ctypes error - "
"double conversion from lltype to ctypes?")
# XXX don't store here immortal structures
- print "LL2CTYPES:", self._getid()
+ print "LL2CTYPES:", addr
ALLOCATED[addr] = self
def _addressof_storage(self):
@@ -579,10 +579,10 @@
return intmask(ctypes.cast(self._storage, ctypes.c_void_p).value)
def _free(self):
- print "LL2C FREE:", self._getid()
self._check() # no double-frees
# allow the ctypes object to go away now
addr = ctypes.cast(self._storage, ctypes.c_void_p).value
+ print "LL2C FREE:", addr
try:
del ALLOCATED[addr]
except KeyError:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit