Commit 3c0c4d06 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix comparison type deduction.

parent 4c7745cd
...@@ -5132,9 +5132,11 @@ class CmpNode(object): ...@@ -5132,9 +5132,11 @@ 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 or type1.assignable_from(type2): if type1 == type2:
new_common_type = type1 new_common_type = type1
elif type2.assignable_from(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 new_common_type = type2
elif type1.is_pyobject and type2.is_pyobject: elif type1.is_pyobject and type2.is_pyobject:
new_common_type = py_object_type new_common_type = py_object_type
......
...@@ -33,3 +33,10 @@ def single_c(int a, int b): ...@@ -33,3 +33,10 @@ def single_c(int a, int b):
def cascaded_c(double a, double b, double c): def cascaded_c(double a, double b, double c):
return a < b < c return a < b < c
def typed_cmp(list L):
"""
>>> typed_cmp([1,2,3])
(False, False)
"""
return L is Ellipsis, Ellipsis is L
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