[pypy-commit] pypy cppyy-packaging: fix indirection error

wlav pypy.commits at gmail.com
Wed Jul 19 16:46:42 EDT 2017


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cppyy-packaging
Changeset: r91929:0b40d2587588
Date: 2017-07-18 17:42 -0700
http://bitbucket.org/pypy/pypy/changeset/0b40d2587588/

Log:	fix indirection error

diff --git a/pypy/module/_cppyy/ffitypes.py b/pypy/module/_cppyy/ffitypes.py
--- a/pypy/module/_cppyy/ffitypes.py
+++ b/pypy/module/_cppyy/ffitypes.py
@@ -82,12 +82,13 @@
 
             value = rffi.cast(rffi.CHAR, space.c_int_w(w_value))
         else:
-            value = space.bytes_w(w_value)
+            value = space.text_w(w_value)
+            if len(value) != 1:
+                raise oefmt(space.w_ValueError,
+                        "char expected, got string of size %d", len(value))
+            value = rffi.cast(rffi.CHAR, value[0])
 
-        if len(value) != 1:  
-            raise oefmt(space.w_ValueError,
-                        "char expected, got string of size %d", len(value))
-        return value[0] # turn it into a "char" to the annotator
+        return value     # turn it into a "char" to the annotator
 
     def cffi_type(self, space):
         state = space.fromcache(State)


More information about the pypy-commit mailing list