[pypy-svn] r67739 - in pypy/trunk/pypy: jit/metainterp/test rpython/ootypesystem
antocuni at codespeak.net
antocuni at codespeak.net
Thu Sep 17 16:53:41 CEST 2009
Author: antocuni
Date: Thu Sep 17 16:53:40 2009
New Revision: 67739
Modified:
pypy/trunk/pypy/jit/metainterp/test/test_basic.py
pypy/trunk/pypy/rpython/ootypesystem/rtupletype.py
Log:
make sure that tuples are immutables also in ootype
Modified: pypy/trunk/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_basic.py Thu Sep 17 16:53:40 2009
@@ -873,9 +873,17 @@
res = self.meta_interp(f, [6, 7], listcomp=True, backendopt=True, listops=True)
# XXX: the loop looks inefficient
assert res == 42
-
-
+ def test_tuple_immutable(self):
+ def new(a, b):
+ return a, b
+ def f(a, b):
+ tup = new(a, b)
+ return tup[1]
+ res = self.interp_operations(f, [3, 5])
+ assert res == 5
+ self.check_history_(setfield_gc=2, getfield_gc_pure=1)
+
class TestOOtype(BasicTests, OOJitMixin):
def test_oohash(self):
Modified: pypy/trunk/pypy/rpython/ootypesystem/rtupletype.py
==============================================================================
--- pypy/trunk/pypy/rpython/ootypesystem/rtupletype.py (original)
+++ pypy/trunk/pypy/rpython/ootypesystem/rtupletype.py Thu Sep 17 16:53:40 2009
@@ -10,4 +10,6 @@
return Void # empty tuple
else:
fields = [('item%d' % i, TYPE) for i, TYPE in enumerate(field_lltypes)]
- return ootype.Record(dict(fields))
+ hints = {'immutable': True,
+ 'noidentity': True}
+ return ootype.Record(dict(fields), _hints=hints)
More information about the Pypy-commit
mailing list