[pypy-commit] pypy ffi-backend: Next test.

arigo noreply at buildbot.pypy.org
Sun Jun 24 16:26:08 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r55801:d725cd802044
Date: 2012-06-24 16:25 +0200
http://bitbucket.org/pypy/pypy/changeset/d725cd802044/

Log:	Next test.

diff --git a/pypy/module/_ffi_backend/ctypeobj.py b/pypy/module/_ffi_backend/ctypeobj.py
--- a/pypy/module/_ffi_backend/ctypeobj.py
+++ b/pypy/module/_ffi_backend/ctypeobj.py
@@ -2,7 +2,7 @@
 from pypy.interpreter.baseobjspace import Wrappable
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from pypy.interpreter.typedef import TypeDef, interp_attrproperty
-from pypy.rpython.lltypesystem import lltype, rffi
+from pypy.rpython.lltypesystem import lltype, llmemory, rffi
 from pypy.rlib.rarithmetic import intmask, ovfcheck
 from pypy.rlib.objectmodel import keepalive_until_here, we_are_translated
 
@@ -75,7 +75,6 @@
         align = self._alignof()
         if not we_are_translated():
             # obscure hack when untranslated, maybe, approximate, don't use
-            from pypy.rpython.lltypesystem import llmemory
             if isinstance(align, llmemory.FieldOffset):
                 align = rffi.sizeof(align.TYPE.y)
         return align
@@ -223,6 +222,20 @@
             for i in range(len(lst_w)):
                 ctitem.convert_from_object(cdata, lst_w[i])
                 cdata = rffi.ptradd(cdata, ctitem.size)
+        elif isinstance(self.ctitem, W_CTypePrimitiveChar):
+            try:
+                s = space.str_w(w_ob)
+            except OperationError, e:
+                if not e.match(space, space.w_TypeError):
+                    raise
+                xxx
+            n = len(s)
+            if self.length >= 0 and n > self.length:
+                xxx
+            for i in range(n):
+                cdata[i] = s[i]
+            if n != self.length:
+                cdata[n] = '\x00'
         else:
             xxx
 


More information about the pypy-commit mailing list