[pypy-svn] r73944 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

afa at codespeak.net afa at codespeak.net
Wed Apr 21 16:56:59 CEST 2010


Author: afa
Date: Wed Apr 21 16:56:57 2010
New Revision: 73944

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_object.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py
   pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
Log:
replace lltype.free with rffi.free_charp, for memory allocated with rffi.str2charp.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py	Wed Apr 21 16:56:57 2010
@@ -44,7 +44,7 @@
     try:
         return generic_cpy_call(space, func_target, w_self, name_ptr)
     finally:
-        lltype.free(name_ptr, flavor="raw")
+        rffi.free_charp(name_ptr)
 
 def wrap_call(space, w_self, w_args, func, w_kwds):
     func_target = rffi.cast(ternaryfunc, func)

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_object.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_object.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_object.py	Wed Apr 21 16:56:57 2010
@@ -56,8 +56,8 @@
         assert not api.PyObject_GetAttrString(space.wrap(""), charp2)
         assert api.PyErr_Occurred() is space.w_AttributeError
         api.PyErr_Clear()
-        lltype.free(charp1, flavor="raw")
-        lltype.free(charp2, flavor="raw")
+        rffi.free_charp(charp1)
+        rffi.free_charp(charp2)
 
     def test_getitem(self, space, api):
         w_t = space.wrap((1, 2, 3, 4, 5))

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py	Wed Apr 21 16:56:57 2010
@@ -54,7 +54,7 @@
         assert rffi.wcharp2unicode(buf) == 'longw'
         api.PyUnicode_AsWideChar(space.wrap(u'a'), buf, 5)
         assert rffi.wcharp2unicode(buf) == 'a'
-        lltype.free(buf, flavor='raw')
+        rffi.free_wcharp(buf)
 
     def test_IS(self, space, api):
         for char in [0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x1c, 0x1d, 0x1e, 0x1f,
@@ -92,5 +92,5 @@
         b_encoding = rffi.str2charp('cp437')
         assert space.unwrap(
             api.PyUnicode_Decode(b_text, 4, b_encoding, None)) == u'caf\xe9'
-        lltype.free(b_text, flavor='raw')
-        lltype.free(b_encoding, flavor='raw')
+        rffi.free_charp(b_text)
+        rffi.free_charp(b_encoding)

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	Wed Apr 21 16:56:57 2010
@@ -442,7 +442,7 @@
         if obj_pto.c_tp_as_buffer:
             lltype.free(obj_pto.c_tp_as_buffer, flavor='raw')
         Py_DecRef(space, base_pyo)
-        lltype.free(obj_pto.c_tp_name, flavor="raw")
+        rffi.free_charp(obj_pto.c_tp_name)
         obj_pto_voidp = rffi.cast(rffi.VOIDP_real, obj_pto)
         generic_cpy_call(space, type_pto.c_tp_free, obj_pto_voidp)
         pto = rffi.cast(PyObject, type_pto)



More information about the Pypy-commit mailing list