Commit 1c5fd0c9 authored by Stefan Behnel's avatar Stefan Behnel

apply flatten-in-list transform also to literal sets

parent 1b5f0b92
...@@ -591,7 +591,9 @@ class FlattenInListTransform(Visitor.VisitorTransform, SkipDeclarations): ...@@ -591,7 +591,9 @@ class FlattenInListTransform(Visitor.VisitorTransform, SkipDeclarations):
else: else:
return node return node
if not isinstance(node.operand2, (ExprNodes.TupleNode, ExprNodes.ListNode)): if not isinstance(node.operand2, (ExprNodes.TupleNode,
ExprNodes.ListNode,
ExprNodes.SetNode)):
return node return node
args = node.operand2.args args = node.operand2.args
......
...@@ -52,16 +52,36 @@ def k(a): ...@@ -52,16 +52,36 @@ def k(a):
cdef int result = a in [1,2,3,4] cdef int result = a in [1,2,3,4]
return result return result
def m(int a): def m_list(int a):
""" """
>>> m(2) >>> m_list(2)
1 1
>>> m(5) >>> m_list(5)
0 0
""" """
cdef int result = a in [1,2,3,4] cdef int result = a in [1,2,3,4]
return result return result
def m_tuple(int a):
"""
>>> m_tuple(2)
1
>>> m_tuple(5)
0
"""
cdef int result = a in (1,2,3,4)
return result
def m_set(int a):
"""
>>> m_set(2)
1
>>> m_set(5)
0
"""
cdef int result = a in {1,2,3,4}
return result
def n(a): def n(a):
""" """
>>> n('d *') >>> n('d *')
......
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