[pypy-svn] r51695 - in pypy/dist/pypy/rpython: . test

arigo at codespeak.net arigo at codespeak.net
Wed Feb 20 16:36:32 CET 2008


Author: arigo
Date: Wed Feb 20 16:36:31 2008
New Revision: 51695

Modified:
   pypy/dist/pypy/rpython/rint.py
   pypy/dist/pypy/rpython/test/test_rdict.py
Log:
Test and fix.


Modified: pypy/dist/pypy/rpython/rint.py
==============================================================================
--- pypy/dist/pypy/rpython/rint.py	(original)
+++ pypy/dist/pypy/rpython/rint.py	Wed Feb 20 16:36:31 2008
@@ -297,7 +297,7 @@
 
     def get_ll_dummyval_obj(self, rtyper, s_value):
         # if >= 0, then all negative values are special
-        if s_value.nonneg and not s_value.unsigned:
+        if s_value.nonneg and self.lowleveltype is Signed:
             return signed_repr    # whose ll_dummy_value is -1
         else:
             return None

Modified: pypy/dist/pypy/rpython/test/test_rdict.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rdict.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rdict.py	Wed Feb 20 16:36:31 2008
@@ -670,6 +670,19 @@
         assert hasattr(DICT.entries.TO.OF, 'f_everused') # all ints can be zero
         assert hasattr(DICT.entries.TO.OF, 'f_valid')    # no dummy available
 
+    def test_opt_boolean_has_no_dummy(self):
+        def f(n):
+            d = {n: True}
+            d[-87] = True
+            del d[n]
+            return len(d.copy()), d[-87], d
+        res = self.interpret(f, [5])
+        assert res.item0 == 1
+        assert res.item1 is True
+        DICT = lltype.typeOf(res.item2).TO
+        assert hasattr(DICT.entries.TO.OF, 'f_everused') # all ints can be zero
+        assert hasattr(DICT.entries.TO.OF, 'f_valid')    # no dummy available
+
     def test_opt_multiple_identical_dicts(self):
         def f(n):
             s = "x" * n



More information about the Pypy-commit mailing list