diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 42640e81919..db571dbe04c 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -1185,7 +1185,7 @@ class Transformer: def com_dictsetmaker(self, nodelist): # dictsetmaker: (test ':' test (',' test ':' value)* [',']) | (test (',' test)* [',']) items = [] - if nodelist[2] != ':': + if len(nodelist) == 1 or nodelist[1] != ':': # it's a set for i in range(1, len(nodelist), 2): items.append(self.com_node(nodelist[i]))