[pypy-commit] pypy cpyext-obj-stealing: fix test to not use cached object

mattip pypy.commits at gmail.com
Sat Apr 29 16:19:37 EDT 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-obj-stealing
Changeset: r91152:d0e8878705c8
Date: 2017-04-29 23:00 +0300
http://bitbucket.org/pypy/pypy/changeset/d0e8878705c8/

Log:	fix test to not use cached object

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
@@ -189,16 +189,17 @@
                 PyObject* o, *o2, *o3;
                 o = PyList_New(1);
 
-                o2 = PyInt_FromLong(0);
+                o2 = PyBytes_FromString("test_get_item0");
+                Py_INCREF(o2);
                 PyList_SET_ITEM(o, 0, o2);
-                o2 = NULL;
 
                 o3 = PyList_GET_ITEM(o, 0);
                 Py_INCREF(o3);
-                Py_CLEAR(o);
+                Py_DECREF(o);
+                Py_DECREF(o2);
                 return o3;
              """)])
-        assert module.test_get_item() == 0
+        assert module.test_get_item() == b'test_get_item0'
 
     def test_item_refcounts(self):
         """PyList_SET_ITEM leaks a reference to the target."""


More information about the pypy-commit mailing list