[pypy-svn] r52532 - in pypy/dist/pypy/lib: _ctypes app_test/ctypes
pedronis at codespeak.net
pedronis at codespeak.net
Fri Mar 14 19:51:24 CET 2008
Author: pedronis
Date: Fri Mar 14 19:51:20 2008
New Revision: 52532
Modified:
pypy/dist/pypy/lib/_ctypes/array.py
pypy/dist/pypy/lib/_ctypes/structure.py
pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py
Log:
make test pass, had to fight with consistency problems in how _CData_value was defined, used
Modified: pypy/dist/pypy/lib/_ctypes/array.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/array.py (original)
+++ pypy/dist/pypy/lib/_ctypes/array.py Fri Mar 14 19:51:20 2008
@@ -97,12 +97,12 @@
if isinstance(value, basestring):
if len(value) > self._length_:
raise ValueError("Invalid length")
- return self(*value)
+ value = self(*value)
else:
if isinstance(value, tuple):
if len(value) > self._length_:
raise RuntimeError("Invalid length")
- return self(*value)
+ value = self(*value)
return _CDataMeta._CData_value(self, value)
def array_get_slice_params(self, index):
Modified: pypy/dist/pypy/lib/_ctypes/structure.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/structure.py (original)
+++ pypy/dist/pypy/lib/_ctypes/structure.py Fri Mar 14 19:51:20 2008
@@ -148,7 +148,7 @@
def _CData_value(self, value):
if isinstance(value, tuple):
- return self(*value)
+ value = self(*value)
return _CDataMeta._CData_value(self, value)
def _CData_output(self, resarray, base=None, index=-1):
@@ -188,7 +188,7 @@
if fieldtype._fficompositesize is not None:
from ctypes import memmove
dest = self._buffer.fieldaddress(name)
- memmove(dest, arg._buffer.buffer, fieldtype._fficompositesize)
+ memmove(dest, arg, fieldtype._fficompositesize)
else:
self._buffer.__setattr__(name, arg)
Modified: pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py (original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py Fri Mar 14 19:51:20 2008
@@ -158,7 +158,6 @@
assert s._objects == {'1:1': {'1': stuff}}
def test_struct_within_struct(self):
- py.test.skip("WIP")
class R(Structure):
_fields_ = [('p', POINTER(c_int))]
More information about the Pypy-commit
mailing list