[pypy-commit] pypy ffistruct: migrate the char case to GetFieldConverter

antocuni noreply at buildbot.pypy.org
Thu Jan 12 14:28:29 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ffistruct
Changeset: r51271:43112b2a9723
Date: 2012-01-12 12:25 +0100
http://bitbucket.org/pypy/pypy/changeset/43112b2a9723/

Log:	migrate the char case to GetFieldConverter

diff --git a/pypy/module/_ffi/interp_struct.py b/pypy/module/_ffi/interp_struct.py
--- a/pypy/module/_ffi/interp_struct.py
+++ b/pypy/module/_ffi/interp_struct.py
@@ -143,8 +143,7 @@
             return converter.do_and_wrap(w_ffitype)
         #
         if w_ffitype.is_char():
-            value = libffi.struct_getfield_int(w_ffitype.ffitype, self.rawmem, offset)
-            return space.wrap(chr(value))
+            return converter.do_and_wrap(w_ffitype)
         #
         if w_ffitype.is_unichar():
             value = libffi.struct_getfield_int(w_ffitype.ffitype, self.rawmem, offset)
@@ -222,8 +221,9 @@
     get_unsigned_which_fits_into_a_signed = get_signed
     get_pointer = get_unsigned
 
-    ## def get_char(self, w_ffitype):
-    ##     ...
+    def get_char(self, w_ffitype):
+        value = libffi.struct_getfield_int(w_ffitype.ffitype, self.rawmem, self.offset)
+        return value
 
     ## def get_unichar(self, w_ffitype):
     ##     ...


More information about the pypy-commit mailing list