Author: Matti Picus <[email protected]>
Branch: call-via-pyobj
Changeset: r85520:192a002624b0
Date: 2016-07-02 22:34 +0300
http://bitbucket.org/pypy/pypy/changeset/192a002624b0/

Log:    fix translation (arigato)

diff --git a/pypy/module/cpyext/methodobject.py 
b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -1,4 +1,4 @@
-from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.rtyper.lltypesystem import lltype, rffi, llmemory
 
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
@@ -176,22 +176,14 @@
                         self.method_name)
         func_to_call = self.func
         if self.offset:
-            ptr = as_pyobj(space, self.w_objclass)
+            pto = as_pyobj(space, self.w_objclass)
             # make ptr the equivalent of this, using the offsets
             #func_to_call = rffi.cast(rffi.VOIDP, 
ptr.c_tp_as_number.c_nb_multiply)
-            if not ptr is rffi.VOIDP:
-                ptr = rffi.cast(rffi.VOIDP, ptr)
+            if pto:
+                ptr = llmemory.cast_ptr_to_adr(pto)
                 for o in self.offset:
-                    if not ptr:
-                        break
-                    ptr_as_int = lltype.cast_ptr_to_int(ptr)
-                    pptr = rffi.cast(rffi.VOIDPP, ptr_as_int + o)
-                    if not pptr:
-                        break
-                    ptr = pptr[0]
-                    ptr = rffi.cast(rffi.VOIDP, ptr)
-                if ptr:
-                    func_to_call = ptr
+                    ptr = (ptr + o).address[0]
+                func_to_call = llmemory.cast_adr_to_ptr(ptr, rffi.VOIDP)
         assert func_to_call
         return self.wrapper_func(space, w_self, w_args, func_to_call)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to