[pypy-commit] pypy cpyext-gc-support: Add asserts

arigo noreply at buildbot.pypy.org
Fri Oct 16 13:50:53 EDT 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-gc-support
Changeset: r80288:8d47155c7ac8
Date: 2015-10-16 19:46 +0200
http://bitbucket.org/pypy/pypy/changeset/8d47155c7ac8/

Log:	Add asserts

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -2850,9 +2850,12 @@
         if rc == REFCNT_FROM_PYPY_DIRECT:
             lltype.free(self._pyobj(pyobject), flavor='raw')
         else:
+            ll_assert(rc < int(REFCNT_FROM_PYPY_DIRECT * 0.99),
+                      "refcount underflow from REFCNT_FROM_PYPY_DIRECT?")
             if rc > REFCNT_FROM_PYPY_DIRECT:
                 rc -= REFCNT_FROM_PYPY_DIRECT
             else:
+                ll_assert(rc >= REFCNT_FROM_PYPY, "refcount underflow?")
                 rc -= REFCNT_FROM_PYPY
                 if rc == 0:
                     xxx  # _Py_Dealloc(pyobject)


More information about the pypy-commit mailing list