[pypy-svn] r50875 - pypy/dist/pypy/lib/_ctypes

fijal at codespeak.net fijal at codespeak.net
Tue Jan 22 14:00:19 CET 2008


Author: fijal
Date: Tue Jan 22 14:00:14 2008
New Revision: 50875

Modified:
   pypy/dist/pypy/lib/_ctypes/basics.py
   pypy/dist/pypy/lib/_ctypes/union.py
Log:
Assert and a fix


Modified: pypy/dist/pypy/lib/_ctypes/basics.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/basics.py	(original)
+++ pypy/dist/pypy/lib/_ctypes/basics.py	Tue Jan 22 14:00:14 2008
@@ -27,6 +27,7 @@
         return cobj._get_buffer_for_param()
 
     def _CData_output(self, resarray):
+        assert isinstance(resarray, _rawffi.ArrayInstance)
         """Used when data exits ctypes and goes into user code.
         'resarray' is a _rawffi array of length 1 containing the value,
         and this returns a general Python object that corresponds.

Modified: pypy/dist/pypy/lib/_ctypes/union.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/union.py	(original)
+++ pypy/dist/pypy/lib/_ctypes/union.py	Tue Jan 22 14:00:14 2008
@@ -49,7 +49,7 @@
             fieldtype = self._fieldtypes[name].ctype
         except KeyError:
             raise AttributeError(name)
-        val = self._ffiarrays[name].fromaddress(self._buffer.buffer, 1)[0]
+        val = self._ffiarrays[name].fromaddress(self._buffer.buffer, 1)
         return fieldtype._CData_output(val)
 
     def __setattr__(self, name, value):



More information about the Pypy-commit mailing list