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

antocuni at codespeak.net antocuni at codespeak.net
Fri Dec 3 11:41:01 CET 2010


Author: antocuni
Date: Fri Dec  3 11:40:58 2010
New Revision: 79771

Modified:
   pypy/branch/jitypes2/lib_pypy/_ctypes/function.py
Log:
do the char-->int conversion based on the declared type, not on the actual value of the argument


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	Fri Dec  3 11:40:58 2010
@@ -385,8 +385,9 @@
         newargs = []
         for argtype, arg in zip(argtypes, args):
             value = arg.value
-            if isinstance(value, basestring) and len(value) == 1:
+            if argtype._ffishape == 'u':
                 # XXX: who should do this conversion? Maybe _ffi?
+                assert isinstance(value, basestring) and len(value) == 1
                 value = ord(value)
             newargs.append(value)
         return newargs



More information about the Pypy-commit mailing list