Commit c46addfa authored by Stefan Behnel's avatar Stefan Behnel

fix for dict literals that end with ','

parent 6608bae8
...@@ -761,6 +761,8 @@ def p_dict_or_set_maker(s): ...@@ -761,6 +761,8 @@ def p_dict_or_set_maker(s):
values = [item] values = [item]
while s.sy == ',': while s.sy == ',':
s.next() s.next()
if s.sy == '}':
break
values.append( p_simple_expr(s) ) values.append( p_simple_expr(s) )
s.expect('}') s.expect('}')
return ExprNodes.SetNode(pos, args=values) return ExprNodes.SetNode(pos, args=values)
...@@ -789,6 +791,8 @@ def p_dict_or_set_maker(s): ...@@ -789,6 +791,8 @@ def p_dict_or_set_maker(s):
items = [ExprNodes.DictItemNode(key.pos, key=key, value=value)] items = [ExprNodes.DictItemNode(key.pos, key=key, value=value)]
while s.sy == ',': while s.sy == ',':
s.next() s.next()
if s.sy == '}':
break
key = p_simple_expr(s) key = p_simple_expr(s)
s.expect(':') s.expect(':')
value = p_simple_expr(s) value = p_simple_expr(s)
......
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