[pypy-svn] r50974 - in pypy/dist/pypy/rpython/lltypesystem: . test
fijal at codespeak.net
fijal at codespeak.net
Thu Jan 24 17:11:08 CET 2008
Author: fijal
Date: Thu Jan 24 17:11:07 2008
New Revision: 50974
Modified:
pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
Add obscure specialcase. I couldn't find better way of handling it,
because .items seems to be immutable however hard I try.
Modified: pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py Thu Jan 24 17:11:07 2008
@@ -234,9 +234,14 @@
carray = cls._malloc(container.getlength())
add_storage(container, _array_mixin, carray)
if not isinstance(ARRAY.OF, lltype.ContainerType):
- for i in range(container.getlength()):
- item_value = container.items[i] # fish fish
- carray.items[i] = lltype2ctypes(item_value)
+ # XXX obscure case when array.items is not modifiable
+ if isinstance(carray.items, unicode):
+ carray.items = u''.join([container.items[i] for i in
+ range(container.getlength())])
+ else:
+ for i in range(container.getlength()):
+ item_value = container.items[i] # fish fish
+ carray.items[i] = lltype2ctypes(item_value)
remove_regular_array_content(container)
else:
assert isinstance(ARRAY.OF, lltype.Struct)
Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py Thu Jan 24 17:11:07 2008
@@ -143,7 +143,6 @@
assert not ALLOCATED # detects memory leaks in the test
def test_unicharp(self):
- py.test.skip("Unsupported")
SP = rffi.CArrayPtr(lltype.UniChar)
s = lltype.malloc(SP.TO, 3, flavor='raw')
s[0] = u'x'
More information about the Pypy-commit
mailing list