[pypy-commit] pypy dynamic-specialized-tuple: use nto the pointer but the struct
fijal
noreply at buildbot.pypy.org
Mon Apr 23 17:59:33 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: dynamic-specialized-tuple
Changeset: r54680:d019b749b73a
Date: 2012-04-23 17:59 +0200
http://bitbucket.org/pypy/pypy/changeset/d019b749b73a/
Log: use nto the pointer but the struct
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
@@ -303,12 +303,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 rffi.cast(lltype.Float, storage.data[i])
+ yield rffi.cast(lltype.Float, storage.data.items[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,9 +582,8 @@
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 elem in ll_enumerate_elements(self.obj):
+ yield elem
for name in T._names:
yield getattr(self.obj, name)
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)
More information about the pypy-commit
mailing list