Author: Armin Rigo <ar...@tunes.org>
Branch: null_byte_after_str
Changeset: r85940:87627df6f41f
Date: 2016-07-30 23:05 +0200
http://bitbucket.org/pypy/pypy/changeset/87627df6f41f/

Log:    Test and fix

diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
--- a/rpython/annotator/binaryop.py
+++ b/rpython/annotator/binaryop.py
@@ -216,11 +216,12 @@
 
     def add((int1, int2)):
         # propagate const-ness to help 'tup[j + 1]'
-        result = pair(int1, int2).union()
+        result = pair(int1, int2)._add_base()
         if int1.is_immutable_constant() and int2.is_immutable_constant():
             result.const = int1.const + int2.const
         return result
     add.can_only_throw = []
+    _add_base = union    # and not another union() from a subclass
     add_ovf = _clone(add, [OverflowError])
 
     def sub((int1, int2)):
diff --git a/rpython/annotator/test/test_annrpython.py 
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -1013,6 +1013,13 @@
         s = a.build_types(f, [s])
         assert s.const == 17
 
+    def test_add_bools(self):
+        def f(a):
+            return (a > 2) + (a < 6)
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [int])
+        assert s.knowntype is int
+
     def test_add_different_ints(self):
         def f(a, b):
             return a + b
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to