Commit 42907790 authored by Jeremy Hylton's avatar Jeremy Hylton

(), [], and {} should not be represented as constant expressions, they

should be calls to BUILD_ ops for these types with no arguments
parent e817acd9
...@@ -656,21 +656,21 @@ class Transformer: ...@@ -656,21 +656,21 @@ class Transformer:
t = nodelist[0][0] t = nodelist[0][0]
if t == token.LPAR: if t == token.LPAR:
if nodelist[1][0] == token.RPAR: if nodelist[1][0] == token.RPAR:
n = Node('const', ()) n = Node('tuple', ())
n.lineno = nodelist[0][2] n.lineno = nodelist[0][2]
return n return n
return self.com_node(nodelist[1]) return self.com_node(nodelist[1])
if t == token.LSQB: if t == token.LSQB:
if nodelist[1][0] == token.RSQB: if nodelist[1][0] == token.RSQB:
n = Node('const', [ ]) n = Node('list', ())
n.lineno = nodelist[0][2] n.lineno = nodelist[0][2]
return n return n
return self.com_list_constructor(nodelist[1]) return self.com_list_constructor(nodelist[1])
if t == token.LBRACE: if t == token.LBRACE:
if nodelist[1][0] == token.RBRACE: if nodelist[1][0] == token.RBRACE:
return Node('const', { }) return Node('dict', ())
return self.com_dictmaker(nodelist[1]) return self.com_dictmaker(nodelist[1])
if t == token.BACKQUOTE: if t == token.BACKQUOTE:
......
...@@ -656,21 +656,21 @@ class Transformer: ...@@ -656,21 +656,21 @@ class Transformer:
t = nodelist[0][0] t = nodelist[0][0]
if t == token.LPAR: if t == token.LPAR:
if nodelist[1][0] == token.RPAR: if nodelist[1][0] == token.RPAR:
n = Node('const', ()) n = Node('tuple', ())
n.lineno = nodelist[0][2] n.lineno = nodelist[0][2]
return n return n
return self.com_node(nodelist[1]) return self.com_node(nodelist[1])
if t == token.LSQB: if t == token.LSQB:
if nodelist[1][0] == token.RSQB: if nodelist[1][0] == token.RSQB:
n = Node('const', [ ]) n = Node('list', ())
n.lineno = nodelist[0][2] n.lineno = nodelist[0][2]
return n return n
return self.com_list_constructor(nodelist[1]) return self.com_list_constructor(nodelist[1])
if t == token.LBRACE: if t == token.LBRACE:
if nodelist[1][0] == token.RBRACE: if nodelist[1][0] == token.RBRACE:
return Node('const', { }) return Node('dict', ())
return self.com_dictmaker(nodelist[1]) return self.com_dictmaker(nodelist[1])
if t == token.BACKQUOTE: if t == token.BACKQUOTE:
......
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