[pypy-commit] pypy cpyext-obj-stealing: test shows that w_list.getitem returns a new PyObject with wrong refcount

mattip pypy.commits at gmail.com
Fri Apr 28 09:14:04 EDT 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-obj-stealing
Changeset: r91145:ae8d9aacb75e
Date: 2017-04-28 16:13 +0300
http://bitbucket.org/pypy/pypy/changeset/ae8d9aacb75e/

Log:	test shows that w_list.getitem returns a new PyObject with wrong
	refcount

diff --git a/pypy/module/cpyext/test/test_listobject.py b/pypy/module/cpyext/test/test_listobject.py
--- a/pypy/module/cpyext/test/test_listobject.py
+++ b/pypy/module/cpyext/test/test_listobject.py
@@ -243,9 +243,10 @@
                 tmp = PyList_GET_ITEM(o, 0);
                 // XXX should tmp be the original i2?
                 //     use CPyListStrategy?
-                if (strcmp(PyString_AsString(tmp), PyString_AsString(i2))) 
+                if ((Py_REFCNT(tmp) != Py_REFCNT(i2))) 
                 {
-                    sprintf(errbuffer, "GETITEM did not return i2");
+                    sprintf(errbuffer, "GETITEM return (%ld) and i2 (%ld)refcounts"
+                            " unequal", (long)Py_REFCNT(tmp), (long)Py_REFCNT(i2));
                     PyErr_SetString(PyExc_AssertionError, errbuffer); 
                     return NULL;
                 }


More information about the pypy-commit mailing list