Author: Alex Gaynor <[email protected]>
Branch: dynamic-specialized-tuple
Changeset: r54684:0bdcf2965cc7
Date: 2012-04-23 12:03 -0400
http://bitbucket.org/pypy/pypy/changeset/0bdcf2965cc7/
Log: merged
diff --git a/pypy/rlib/rerased_raw.py b/pypy/rlib/rerased_raw.py
--- a/pypy/rlib/rerased_raw.py
+++ b/pypy/rlib/rerased_raw.py
@@ -304,12 +304,12 @@
def ll_enumerate_elements(storage):
for i, elem in enumerate(storage.shape.chars):
if elem in [INSTANCE, STRING, UNICODE]:
- yield storage.data[i].ptr
+ yield storage.data.items[i].ptr
elif elem == INT:
- yield rffi.cast(lltype.Signed, storage.data[i])
+ yield rffi.cast(lltype.Signed, storage.data.items[i])
elif elem == FLOAT:
yield longlong2float.longlong2float(rffi.cast(lltype.Signed,
storage.data[i]))
elif elem == BOOL:
- yield rffi.cast(lltype.Bool, storage.data[i])
+ yield rffi.cast(lltype.Bool, storage.data.items[i])
else:
assert False
diff --git a/pypy/rlib/test/test_rerased_raw.py
b/pypy/rlib/test/test_rerased_raw.py
--- a/pypy/rlib/test/test_rerased_raw.py
+++ b/pypy/rlib/test/test_rerased_raw.py
@@ -193,7 +193,7 @@
storage.setbool(2, True)
return storage
- llres = self.interpret(f, [])
+ llres = self.interpret(f, [])._obj
lst = list(rerased_raw.ll_enumerate_elements(llres))
assert hlstr(lst[0]) == "abc"
assert lst[1:] == [13, True, 3.5]
diff --git a/pypy/translator/c/node.py b/pypy/translator/c/node.py
--- a/pypy/translator/c/node.py
+++ b/pypy/translator/c/node.py
@@ -13,7 +13,7 @@
from pypy.rlib import exports
from pypy.rlib.rfloat import isfinite
from pypy.rlib.rstackovf import _StackOverflow
-from pypy.rlib.rerased_raw import xxx
+from pypy.rlib.rerased_raw import ll_enumerate_elements
from pypy.translator.c import extfunc
from pypy.translator.tool.cbuild import ExternalCompilationInfo
from py.builtin import BaseException
@@ -582,11 +582,11 @@
shapefld = [fld for fld in T._flds if fld != arrayfld][0]
shape = getattr(self.obj, shapefld)
yield shape
- for elem in shape.chars:
- import pdb
- pdb.set_trace()
- for name in T._names:
- yield getattr(self.obj, name)
+ for elem in ll_enumerate_elements(self.obj):
+ yield elem
+ else:
+ for name in T._names:
+ yield getattr(self.obj, name)
def getlength(self):
T = self.getTYPE()
diff --git a/pypy/translator/c/test/test_untyped_storage.py
b/pypy/translator/c/test/test_untyped_storage.py
--- a/pypy/translator/c/test/test_untyped_storage.py
+++ b/pypy/translator/c/test/test_untyped_storage.py
@@ -3,6 +3,9 @@
from pypy.translator.c.test.test_genc import compile
class CCompiledMixin(object):
+ # for individual tests see
+ # ===> ../../../rlib/test/test_rerased_raw.py
+
def interpret(self, f, args):
fn = compile(f, [type(arg) for arg in args], gcpolicy='boehm')
return fn(*args)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit