Commit 7ec14202 authored by Xavier Thompson's avatar Xavier Thompson

Fix handling of 'is' and 'is not' comparisons between a cpp object and a pyobject

parent 228ffec9
...@@ -13130,6 +13130,10 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -13130,6 +13130,10 @@ class PrimaryCmpNode(ExprNode, CmpNode):
def analyse_cpp_py_comparison(self, env): def analyse_cpp_py_comparison(self, env):
operator = self.operator operator = self.operator
if self.operator in ('is', 'is_not'):
# non-overridable comparisons, let cpp analysis decide whether this is an error
self.analyse_cpp_comparison(env)
return self
if self.operand2.type.is_cyp_class and operator in ("in", "not_in"): if self.operand2.type.is_cyp_class and operator in ("in", "not_in"):
# swap operands # swap operands
self.operand1, self.operand2 = self.operand2, self.operand1 self.operand1, self.operand2 = self.operand2, self.operand1
......
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