[pypy-commit] pypy cpyext-realloc: test, fix for translated realloc

mattip pypy.commits at gmail.com
Mon Aug 1 23:53:32 EDT 2016


Author: mattip <matti.picus at gmail.com>
Branch: cpyext-realloc
Changeset: r85978:12bb1db94194
Date: 2016-08-02 06:37 +0300
http://bitbucket.org/pypy/pypy/changeset/12bb1db94194/

Log:	test, fix for translated realloc

diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -21,6 +21,8 @@
                          flavor='raw',
                          add_memory_pressure=True)
 
+realloc = rffi.llexternal('realloc', [rffi.VOIDP, rffi.SIZE_T], rffi.VOIDP)
+
 @cpython_api([rffi.VOIDP, size_t], rffi.VOIDP)
 def PyObject_Realloc(space, ptr, size):
     if not lltype.cast_ptr_to_int(ptr):
@@ -28,7 +30,7 @@
                          flavor='raw',
                          add_memory_pressure=True)
     # XXX FIXME
-    return lltype.nullptr(rffi.VOIDP.TO)
+    return realloc(ptr, size)
 
 @cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_Free(space, ptr):
diff --git a/pypy/module/cpyext/test/test_object.py b/pypy/module/cpyext/test/test_object.py
--- a/pypy/module/cpyext/test/test_object.py
+++ b/pypy/module/cpyext/test/test_object.py
@@ -235,7 +235,6 @@
         assert type(x) is int
         assert x == -424344
 
-    @pytest.mark.skipif(True, reason='realloc not fully implemented')
     def test_object_realloc(self):
         module = self.import_extension('foo', [
             ("realloctest", "METH_NOARGS",


More information about the pypy-commit mailing list