[pypy-commit] pypy cffi-1.0: Typenames

arigo noreply at buildbot.pypy.org
Fri May 8 10:25:01 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r77192:142f9ca18dcc
Date: 2015-05-08 09:33 +0200
http://bitbucket.org/pypy/pypy/changeset/142f9ca18dcc/

Log:	Typenames

diff --git a/pypy/module/_cffi_backend/realize_c_type.py b/pypy/module/_cffi_backend/realize_c_type.py
--- a/pypy/module/_cffi_backend/realize_c_type.py
+++ b/pypy/module/_cffi_backend/realize_c_type.py
@@ -161,6 +161,14 @@
     elif case == cffi_opcode.OP_NOOP:
         x = realize_c_type_or_func(ffi, opcodes, getarg(op))
 
+    elif case == cffi_opcode.OP_TYPENAME:
+        # essential: the TYPENAME opcode resolves the type index looked
+        # up in the 'ctx.c_typenames' array, but it does so in 'ctx.c_types'
+        # instead of in 'opcodes'!
+        type_index = rffi.getintfield(ffi.ctxobj.ctx.c_typenames[getarg(op)],
+                                      'c_type_index')
+        x = realize_c_type_or_func(ffi, ffi.ctxobj.ctx.c_types, type_index)
+
     else:
         raise oefmt(ffi.space.w_NotImplementedError, "op=%d", case)
 


More information about the pypy-commit mailing list