Commit 1c1fd444 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix ctuple comparison.

parent 6d23c845
...@@ -10501,11 +10501,10 @@ class CmpNode(object): ...@@ -10501,11 +10501,10 @@ class CmpNode(object):
if new_common_type is None: if new_common_type is None:
# fall back to generic type compatibility tests # fall back to generic type compatibility tests
if type1 == type2: if type1.is_ctuple or type2.is_ctuple:
if type1.is_ctuple: new_common_type = py_object_type
new_common_type = py_object_type elif type1 == type2:
else: new_common_type = type1
new_common_type = type1
elif type1.is_pyobject or type2.is_pyobject: elif type1.is_pyobject or type2.is_pyobject:
if type2.is_numeric or type2.is_string: if type2.is_numeric or type2.is_string:
if operand2.check_for_coercion_error(type1, env): if operand2.check_for_coercion_error(type1, env):
......
...@@ -120,6 +120,17 @@ def test_equality((int, int) ab, (int, int) cd, (int, int) ef): ...@@ -120,6 +120,17 @@ def test_equality((int, int) ab, (int, int) cd, (int, int) ef):
""" """
return ab < cd <= ef return ab < cd <= ef
def test_equality_different_types((double, int) ab, (int, int) cd, (long, int) ef):
"""
>>> test_equality((1, 2), (3, 4), (5, 6))
True
>>> test_equality((1, 2), (3, 4), (3, 4))
True
>>> test_equality((3, 4), (3, 4), (3, 4))
False
"""
return ab < cd <= ef
def test_binop((int, int) ab, (double, double) cd): def test_binop((int, int) ab, (double, double) cd):
""" """
>>> test_binop((1, 2), (3, 4)) >>> test_binop((1, 2), (3, 4))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment