Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4290779

Browse files
committed
(), [], and {} should not be represented as constant expressions, they
should be calls to BUILD_ ops for these types with no arguments
1 parent e817acd commit 4290779

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/compiler/transformer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,21 +656,21 @@ def atom(self, nodelist):
656656
t = nodelist[0][0]
657657
if t == token.LPAR:
658658
if nodelist[1][0] == token.RPAR:
659-
n = Node('const', ())
659+
n = Node('tuple', ())
660660
n.lineno = nodelist[0][2]
661661
return n
662662
return self.com_node(nodelist[1])
663663

664664
if t == token.LSQB:
665665
if nodelist[1][0] == token.RSQB:
666-
n = Node('const', [ ])
666+
n = Node('list', ())
667667
n.lineno = nodelist[0][2]
668668
return n
669669
return self.com_list_constructor(nodelist[1])
670670

671671
if t == token.LBRACE:
672672
if nodelist[1][0] == token.RBRACE:
673-
return Node('const', { })
673+
return Node('dict', ())
674674
return self.com_dictmaker(nodelist[1])
675675

676676
if t == token.BACKQUOTE:

Tools/compiler/compiler/transformer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,21 +656,21 @@ def atom(self, nodelist):
656656
t = nodelist[0][0]
657657
if t == token.LPAR:
658658
if nodelist[1][0] == token.RPAR:
659-
n = Node('const', ())
659+
n = Node('tuple', ())
660660
n.lineno = nodelist[0][2]
661661
return n
662662
return self.com_node(nodelist[1])
663663

664664
if t == token.LSQB:
665665
if nodelist[1][0] == token.RSQB:
666-
n = Node('const', [ ])
666+
n = Node('list', ())
667667
n.lineno = nodelist[0][2]
668668
return n
669669
return self.com_list_constructor(nodelist[1])
670670

671671
if t == token.LBRACE:
672672
if nodelist[1][0] == token.RBRACE:
673-
return Node('const', { })
673+
return Node('dict', ())
674674
return self.com_dictmaker(nodelist[1])
675675

676676
if t == token.BACKQUOTE:

0 commit comments

Comments
 (0)