Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r59781:dc75dbc8a7dd
Date: 2013-01-05 22:31 +0200
http://bitbucket.org/pypy/pypy/changeset/dc75dbc8a7dd/
Log: a test and a fix
diff --git a/pypy/rlib/rgc.py b/pypy/rlib/rgc.py
--- a/pypy/rlib/rgc.py
+++ b/pypy/rlib/rgc.py
@@ -140,10 +140,11 @@
return hop.genop(opname, vlist, resulttype = hop.r_result.lowleveltype)
def copy_struct_item(source, dest, si, di):
- TP = lltype.typeOf(source)
+ TP = lltype.typeOf(source).TO.OF
i = 0
while i < len(TP._names):
setattr(dest[di], TP._names[i], getattr(source[si], TP._names[i]))
+ i += 1
class CopyStructEntry(ExtRegistryEntry):
_about_ = copy_struct_item
diff --git a/pypy/rlib/test/test_rgc.py b/pypy/rlib/test/test_rgc.py
--- a/pypy/rlib/test/test_rgc.py
+++ b/pypy/rlib/test/test_rgc.py
@@ -150,7 +150,13 @@
interpret(f, [])
- f()
+ a1 = lltype.malloc(TP, 3)
+ a2 = lltype.malloc(TP, 3)
+ a1[1].x = 3
+ a1[1].y = 15
+ rgc.copy_struct_item(a1, a2, 1, 2)
+ assert a2[2].x == 3
+ assert a2[2].y == 15
def test_ll_arraycopy_small():
TYPE = lltype.GcArray(lltype.Signed)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit