Commit 2e864668 authored by Robert Bradshaw's avatar Robert Bradshaw

More comparison fixes.

parent 3c0c4d06
......@@ -5134,23 +5134,19 @@ class CmpNode(object):
# fall back to generic type compatibility tests
if type1 == type2:
new_common_type = type1
elif not type2 is py_object_type and type1.assignable_from(type2):
new_common_type = type1
elif not type1 is py_object_type and type2.assignable_from(type1):
new_common_type = type2
elif type1.is_pyobject and type2.is_pyobject:
new_common_type = py_object_type
elif type1.is_pyobject or type2.is_pyobject:
if type2.is_numeric or type2.is_string:
if operand2.check_for_coercion_error(type1):
new_common_type = error_type
else:
new_common_type = type1
new_common_type = py_object_type
elif type1.is_numeric or type1.is_string:
if operand1.check_for_coercion_error(type2):
new_common_type = error_type
else:
new_common_type = type2
new_common_type = py_object_type
elif py_object_type.assignable_from(type1) and py_object_type.assignable_from(type2):
new_common_type = py_object_type
else:
# one Python type and one non-Python type, not assignable
self.invalid_types_error(operand1, op, operand2)
......
......@@ -37,6 +37,12 @@ def cascaded_c(double a, double b, double c):
def typed_cmp(list L):
"""
>>> typed_cmp([1,2,3])
(False, False)
False
False
False
False
"""
return L is Ellipsis, Ellipsis is L
print L is Ellipsis
print Ellipsis is L
print 1 == L
print L == 1.5
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