Commit 6b1b8ed9 authored by Stefan Behnel's avatar Stefan Behnel

it may be an error to lt/gt compare a complex number to a complex or C-numeric...

it may be an error to lt/gt compare a complex number to a complex or C-numeric type, but not to an arbitrary other type

--HG--
extra : transplant_source : %95%EA%C2%9B%7C%D5h%B44%C8%2A%1EO%88%AB%FAP%9C%3B%95
parent 21664c38
......@@ -6728,10 +6728,12 @@ class CmpNode(object):
# try to use numeric comparisons where possible
elif type1.is_complex or type2.is_complex:
if op not in ('==', '!='):
if op not in ('==', '!=') \
and (type1.is_complex or type1.is_numeric) \
and (type2.is_complex or type2.is_numeric):
error(self.pos, "complex types are unordered")
new_common_type = error_type
if type1.is_pyobject:
elif type1.is_pyobject:
new_common_type = type1
elif type2.is_pyobject:
new_common_type = type2
......
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