[pypy-svn] r80026 - pypy/branch/jitypes2/lib_pypy/_ctypes

antocuni at codespeak.net antocuni at codespeak.net
Mon Dec 13 11:02:46 CET 2010


Author: antocuni
Date: Mon Dec 13 11:02:45 2010
New Revision: 80026

Modified:
   pypy/branch/jitypes2/lib_pypy/_ctypes/function.py
Log:
support string arguments and results. Makes test_stringresult passing


Modified: pypy/branch/jitypes2/lib_pypy/_ctypes/function.py
==============================================================================
--- pypy/branch/jitypes2/lib_pypy/_ctypes/function.py	(original)
+++ pypy/branch/jitypes2/lib_pypy/_ctypes/function.py	Mon Dec 13 11:02:45 2010
@@ -399,6 +399,8 @@
                 value = ord(value)
             elif argtype._ffishape == 'P':
                 value = arg._get_buffer_value()
+            elif argtype._ffishape == 'z':
+                value = arg._get_buffer_value()
             else:
                 value = arg.value
             newargs.append(value)
@@ -419,6 +421,8 @@
                 result = None
             else:
                 assert False, 'TODO'
+        elif restype._ffishape == 'z':
+            result = restype(result).value # XXX: maybe it's the general way to do it?
         return result
 
     def _build_result(self, restype, resbuffer, argtypes, argsandobjs):



More information about the Pypy-commit mailing list