[pypy-svn] r76609 - in pypy/branch/fast-ctypes/pypy/module/jitffi: . test

getxsick at codespeak.net getxsick at codespeak.net
Thu Aug 12 19:09:01 CEST 2010


Author: getxsick
Date: Thu Aug 12 19:08:59 2010
New Revision: 76609

Modified:
   pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py
   pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py
Log:
fix for commented test and translastion


Modified: pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py	(original)
+++ pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py	Thu Aug 12 19:08:59 2010
@@ -160,8 +160,9 @@
         charp = rffi.cast(rffi.CCHARP, addr)
         return space.wrap(rffi.charp2str(charp)) # XXX free it?
 
-    def adr_to_intp_w(self, space, addr):
-        return space.wrap(rffi.cast(rffi.INTP, addr))
+    def get_int_from_addr_w(self, space, addr):
+        intp = rffi.cast(rffi.INTP, addr)
+        return space.wrap(intp[0]) # return the first element
 
 def W_Test___new__(space, w_x):
     return space.wrap(W_Test(space))
@@ -175,6 +176,6 @@
                               unwrap_spec=['self', ObjSpace, str]),
         get_str = interp2app(W_Test.get_str_w,
                               unwrap_spec=['self', ObjSpace, int]),
-        adr_to_intp = interp2app(W_Test.adr_to_intp_w,
+        get_int_from_addr = interp2app(W_Test.get_int_from_addr_w,
                                  unwrap_spec=['self', ObjSpace, int])
 )

Modified: pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py	(original)
+++ pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py	Thu Aug 12 19:08:59 2010
@@ -151,15 +151,15 @@
         func.call([charp])
         assert t.get_str(charp) == 'xbxbxb'
 
-    #def test_get_ptr(self):
-    #    import jitffi
-    #    t = jitffi.Test()
-    #    lib = jitffi.CDLL(self.lib_name)
+    def test_get_ptr(self):
+        import jitffi
+        t = jitffi.Test()
+        lib = jitffi.CDLL(self.lib_name)
 
-    #    func = lib.get('return_intptr', ['i'], 'p')
-    #    addr = func.call([22])
-    #    ret = t.adr_to_intp(addr)
-    #    assert ret[0] == 22
+        func = lib.get('return_intptr', ['i'], 'p')
+        addr = func.call([22])
+        ret = t.get_int_from_addr(addr)
+        assert ret == 22
 
     def test_undefined_func(self):
         import jitffi



More information about the Pypy-commit mailing list