Commit 07629865 authored by Stefan Behnel's avatar Stefan Behnel

fix reversed order of operands in constant calculation for 'in' and 'not in' operator

parent e896d20f
......@@ -8219,9 +8219,6 @@ class TypeofNode(ExprNode):
#
#-------------------------------------------------------------------
def _not_in(x, seq):
return x not in seq
compile_time_binary_operators = {
'<': operator.lt,
'<=': operator.le,
......@@ -8243,8 +8240,8 @@ compile_time_binary_operators = {
'>>': operator.rshift,
'-': operator.sub,
'^': operator.xor,
'in': operator.contains,
'not_in': _not_in,
'in': lambda x, seq: x in seq,
'not_in': lambda x, seq: x not in seq,
}
def get_compile_time_binop(node):
......
......@@ -131,3 +131,15 @@ def str_slicing2():
str3 = 'abc\xE9def'[2:4]
return str0, str1, str2, str3
@cython.test_fail_if_path_exists(
"//IfStatNode",
)
def str_in_and_not_in():
"""
>>> str_in_and_not_in()
True
"""
if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': return True
else: return False
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