summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Braun <nils.braun@kit.edu>2017-10-28 16:03:37 +0200
committerNils Braun <nils.braun@kit.edu>2017-10-28 16:03:37 +0200
commitab7b75cd4db9ddab7f5456ed1cfdc3b0e11ffb98 (patch)
treed0a31c8d681d9fdae99c8f31d564db77bd87f16e
parent40b884673dc0ec01c5139f4303f88fd1830c9fb8 (diff)
downloadcython-ab7b75cd4db9ddab7f5456ed1cfdc3b0e11ffb98.tar.gz
Return a pythran expr when interfering the types in a compare node
-rw-r--r--Cython/Compiler/ExprNodes.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index d2ee031af..e56088cb1 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -12246,7 +12246,13 @@ class PrimaryCmpNode(ExprNode, CmpNode):
is_memslice_nonecheck = False
def infer_type(self, env):
- # TODO: Actually implement this (after merging with -unstable).
+ type1 = self.operand1.infer_type(env)
+ type2 = self.operand2.infer_type(env)
+
+ if is_pythran_expr(type1) or is_pythran_expr(type2):
+ if is_pythran_supported_type(type1) and is_pythran_supported_type(type2):
+ return PythranExpr(pythran_binop_type(self.operator, type1, type2))
+
return py_object_type
def type_dependencies(self, env):