Author: Matti Picus <[email protected]>
Branch: cpyext-obj-stealing
Changeset: r91060:95c7e6ee21b6
Date: 2017-04-16 08:30 +0300
http://bitbucket.org/pypy/pypy/changeset/95c7e6ee21b6/
Log: assert recount of linked objects is REFCNT_FROM_PYPY which fails for
listobjects
diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -30,8 +30,7 @@
return subtype_dealloc.api_func
def allocate(self, space, w_type, itemcount=0):
- # similar to PyType_GenericAlloc?
- # except that it's not related to any pypy object.
+ # typically called from PyType_GenericAlloc via typedescr.allocate
# this returns a PyObject with ob_refcnt == 1.
pytype = as_pyobj(space, w_type)
@@ -315,6 +314,7 @@
obj = rffi.cast(PyObject, obj)
if obj:
assert obj.c_ob_refcnt > 0
+ assert obj.c_ob_pypy_link == 0 or obj.c_ob_refcnt >
rawrefcount.REFCNT_FROM_PYPY
obj.c_ob_refcnt -= 1
if obj.c_ob_refcnt == 0:
_Py_Dealloc(space, obj)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit