Skip to content

Commit

Permalink
it may be an error to lt/gt compare a complex number to a complex or …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Stefan Behnel committed Sep 11, 2011
1 parent 21664c3 commit 6b1b8ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Cython/Compiler/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6728,10 +6728,12 @@ def find_common_type(self, env, op, operand1, common_type=None):

# 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
Expand Down

0 comments on commit 6b1b8ed

Please sign in to comment.