[pypy-commit] pypy cpyext-ext: Improve the debug checks. Shows an issue with string_alloc() in cpyext
arigo
pypy.commits at gmail.com
Sun Mar 13 06:04:00 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-ext
Changeset: r83007:54e7251ae418
Date: 2016-03-13 11:03 +0100
http://bitbucket.org/pypy/pypy/changeset/54e7251ae418/
Log: Improve the debug checks. Shows an issue with string_alloc() in
cpyext
diff --git a/rpython/rlib/rawrefcount.py b/rpython/rlib/rawrefcount.py
--- a/rpython/rlib/rawrefcount.py
+++ b/rpython/rlib/rawrefcount.py
@@ -27,12 +27,13 @@
"""NOT_RPYTHON: set up rawrefcount with the GC. This is only used
for tests; it should not be called at all during translation.
"""
- global _p_list, _o_list, _adr2pypy, _pypy2ob
+ global _p_list, _o_list, _adr2pypy, _pypy2ob, _ob_set
global _d_list, _dealloc_trigger_callback
_p_list = []
_o_list = []
_adr2pypy = [None]
_pypy2ob = {}
+ _ob_set = set()
_d_list = []
_dealloc_trigger_callback = dealloc_trigger_callback
@@ -40,19 +41,23 @@
"NOT_RPYTHON: a link where the PyPy object contains some or all the data"
#print 'create_link_pypy\n\t%s\n\t%s' % (p, ob)
assert p not in _pypy2ob
- #assert not ob.c_ob_pypy_link
+ assert ob._obj not in _ob_set
+ assert not ob.c_ob_pypy_link
ob.c_ob_pypy_link = _build_pypy_link(p)
_pypy2ob[p] = ob
_p_list.append(ob)
+ _ob_set.add(ob._obj)
def create_link_pyobj(p, ob):
"""NOT_RPYTHON: a link where the PyObject contains all the data.
from_obj() will not work on this 'p'."""
#print 'create_link_pyobj\n\t%s\n\t%s' % (p, ob)
assert p not in _pypy2ob
- #assert not ob.c_ob_pypy_link
+ assert ob._obj not in _ob_set
+ assert not ob.c_ob_pypy_link
ob.c_ob_pypy_link = _build_pypy_link(p)
_o_list.append(ob)
+ _ob_set.add(ob._obj)
def from_obj(OB_PTR_TYPE, p):
"NOT_RPYTHON"
More information about the pypy-commit
mailing list