[pypy-svn] r73806 - pypy/branch/cpython-extension/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Fri Apr 16 11:56:09 CEST 2010


Author: afa
Date: Fri Apr 16 11:55:51 2010
New Revision: 73806

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py
Log:
Improve debug message when refcount is negative


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py	Fri Apr 16 11:55:51 2010
@@ -130,7 +130,6 @@
 
 def create_ref(space, w_obj, items=0):
     from pypy.module.cpyext.typeobject import W_PyCTypeObject, PyOLifeline
-    from pypy.module.cpyext.pycobject import W_PyCObject, PyCObject
     w_type = space.type(w_obj)
     typedescr = get_typedescr(w_obj.typedef)
 
@@ -264,8 +263,10 @@
             del state.borrow_mapping[ptr]
     else:
         if not we_are_translated() and obj.c_ob_refcnt < 0:
-            print >>sys.stderr, "Negative refcount for obj %s with type %s" % (obj, rffi.charp2str(obj.c_ob_type.c_tp_name))
-            assert False
+            message = "Negative refcount for obj %s with type %s" % (
+                obj, rffi.charp2str(obj.c_ob_type.c_tp_name))
+            print >>sys.stderr, message
+            assert False, message
 
 @cpython_api([PyObject], lltype.Void)
 def Py_IncRef(space, obj):



More information about the Pypy-commit mailing list