[pypy-commit] pypy default: fix test - call Py_DecRef on PyObject to allow finalizer to run

mattip pypy.commits at gmail.com
Mon Jan 16 16:21:07 EST 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r89621:13bdc04dc6d2
Date: 2017-01-16 23:20 +0200
http://bitbucket.org/pypy/pypy/changeset/13bdc04dc6d2/

Log:	fix test - call Py_DecRef on PyObject to allow finalizer to run

diff --git a/pypy/module/cpyext/test/test_memoryobject.py b/pypy/module/cpyext/test/test_memoryobject.py
--- a/pypy/module/cpyext/test/test_memoryobject.py
+++ b/pypy/module/cpyext/test/test_memoryobject.py
@@ -30,13 +30,14 @@
         assert view.c_len == 5
         o = rffi.charp2str(view.c_buf)
         assert o == 'hello'
-        w_mv = from_ref(space, api.PyMemoryView_FromBuffer(view))
+        ref = api.PyMemoryView_FromBuffer(view)
+        w_mv = from_ref(space, ref)
         for f in ('format', 'itemsize', 'ndim', 'readonly', 
                   'shape', 'strides', 'suboffsets'):
             w_f = space.wrap(f)
             assert space.eq_w(space.getattr(w_mv, w_f), 
                               space.getattr(w_memoryview, w_f))
-
+        api.Py_DecRef(ref)
 
 class AppTestPyBuffer_FillInfo(AppTestCpythonExtensionBase):
     def test_fillWithObject(self):


More information about the pypy-commit mailing list