[pypy-commit] pypy value-classes: Make a note and undo some changes to tests

sbauman pypy.commits at gmail.com
Wed Sep 21 14:21:53 EDT 2016


Author: Spenser Bauman <sabauma at gmail.com>
Branch: value-classes
Changeset: r87289:41ba0c22b58a
Date: 2016-09-21 14:19 -0400
http://bitbucket.org/pypy/pypy/changeset/41ba0c22b58a/

Log:	Make a note and undo some changes to tests

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -124,11 +124,11 @@
     NODE3.become(lltype.GcStruct('NODE3', ('parent', OBJECT),
                             ('value', lltype.Signed),
                             ('next', lltype.Ptr(NODE3)),
-                            hints={'value_class': True}))
+                            hints={'immutable': True}))
 
     big_fields = [('big' + i, lltype.Signed) for i in string.ascii_lowercase]
     BIG = lltype.GcForwardReference()
-    BIG.become(lltype.GcStruct('BIG', *big_fields, hints={'value_class': True}))
+    BIG.become(lltype.GcStruct('BIG', *big_fields, hints={'immutable': True}))
 
     for field, _ in big_fields:
         locals()[field + 'descr'] = cpu.fielddescrof(BIG, field)
diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -370,6 +370,9 @@
         return _struct(self, n, initialization='example')
 
     def _immutable_field(self, field):
+        # The translator no longer accepts the _immutable_=True annotation
+        # but it is useful to have an to have a shorthand for immutable objects
+        # which are value classes for testing purposes.
         if (self._hints.get('immutable') or
             self._hints.get('value_class')):
             return True


More information about the pypy-commit mailing list