[pypy-svn] r32160 - in pypy/branch/more-gckinds/pypy: annotation rpython/lltypesystem rpython/test
mwh at codespeak.net
mwh at codespeak.net
Mon Sep 11 16:41:57 CEST 2006
Author: mwh
Date: Mon Sep 11 16:41:57 2006
New Revision: 32160
Modified:
pypy/branch/more-gckinds/pypy/annotation/model.py
pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py
pypy/branch/more-gckinds/pypy/rpython/test/test_rptr.py
Log:
remove _TYPE from _interior_ptr -- thanks for the prodding arigo
Modified: pypy/branch/more-gckinds/pypy/annotation/model.py
==============================================================================
--- pypy/branch/more-gckinds/pypy/annotation/model.py (original)
+++ pypy/branch/more-gckinds/pypy/annotation/model.py Mon Sep 11 16:41:57 2006
@@ -630,6 +630,12 @@
# adtmeths: the getattr() result is then a plain FunctionType object.
from pypy.annotation.bookkeeper import getbookkeeper
return getbookkeeper().immutablevalue(v)
+ if isinstance(v, lltype._interior_ptr):
+ ob = v._parent
+ if ob is None:
+ raise RuntimeError
+ T = lltype.InteriorPtr(lltype.typeOf(ob), v._T, v._offsets)
+ return SomeInteriorPtr(T)
return lltype_to_annotation(lltype.typeOf(v))
# ____________________________________________________________
Modified: pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py (original)
+++ pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py Mon Sep 11 16:41:57 2006
@@ -1205,7 +1205,7 @@
if ob is None:
raise RuntimeError
return InteriorPtr(typeOf(ob), self._T, self._offsets)
- _TYPE = property(_get_TYPE)
+## _TYPE = property(_get_TYPE)
def _expose(self, offset, val):
"""XXX A nice docstring here"""
Modified: pypy/branch/more-gckinds/pypy/rpython/test/test_rptr.py
==============================================================================
--- pypy/branch/more-gckinds/pypy/rpython/test/test_rptr.py (original)
+++ pypy/branch/more-gckinds/pypy/rpython/test/test_rptr.py Mon Sep 11 16:41:57 2006
@@ -209,11 +209,9 @@
def test_interior_ptr():
S = Struct("S", ('x', Signed))
T = GcStruct("T", ('s', S))
- def g(s):
- s.x = 1
def f():
t = malloc(T)
- g(t.s)
+ t.s.x = 1
return t.s.x
res = interpret(f, [])
assert res == 1
@@ -221,11 +219,9 @@
def test_interior_ptr_with_index():
S = Struct("S", ('x', Signed))
T = GcArray(S)
- def g(s):
- s.x = 1
def f():
t = malloc(T, 1)
- g(t[0])
+ t[0].x = 1
return t[0].x
res = interpret(f, [])
assert res == 1
@@ -233,11 +229,9 @@
def test_interior_ptr_with_field_and_index():
S = Struct("S", ('x', Signed))
T = GcStruct("T", ('items', Array(S)))
- def g(s):
- s.x = 1
def f():
t = malloc(T, 1)
- g(t.items[0])
+ t.items[0].x = 1
return t.items[0].x
res = interpret(f, [])
assert res == 1
@@ -246,11 +240,9 @@
S = Struct("S", ('x', Signed))
T = Struct("T", ('s', S))
U = GcArray(T)
- def g(s):
- s.x = 1
def f():
u = malloc(U, 1)
- g(u[0].s)
+ u[0].s.x = 1
return u[0].s.x
res = interpret(f, [])
assert res == 1
@@ -266,11 +258,9 @@
def test_interior_ptr_with_setitem():
T = GcStruct("T", ('s', Array(Signed)))
- def g(a):
- a[0] = 1
def f():
t = malloc(T, 1)
- g(t.s)
+ t.s[0] = 1
return t.s[0]
res = interpret(f, [])
assert res == 1
More information about the Pypy-commit
mailing list