]> granicus.if.org Git - python/commitdiff
(), [], and {} should not be represented as constant expressions, they
authorJeremy Hylton <jeremy@alum.mit.edu>
Mon, 14 Feb 2000 18:32:46 +0000 (18:32 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Mon, 14 Feb 2000 18:32:46 +0000 (18:32 +0000)
should be calls to BUILD_ ops for these types with no arguments

Lib/compiler/transformer.py
Tools/compiler/compiler/transformer.py

index b85b498ec8021bafc2649d2cb76304657fa173fd..2fb442a5de12a26a347599cbd0a558de1a43f605 100644 (file)
@@ -656,21 +656,21 @@ class Transformer:
     t = nodelist[0][0]
     if t == token.LPAR:
       if nodelist[1][0] == token.RPAR:
-        n = Node('const', ())
+        n = Node('tuple', ())
         n.lineno = nodelist[0][2]
         return n
       return self.com_node(nodelist[1])
 
     if t == token.LSQB:
       if nodelist[1][0] == token.RSQB:
-        n = Node('const', [ ])
+        n = Node('list', ())
         n.lineno = nodelist[0][2]
         return n
       return self.com_list_constructor(nodelist[1])
 
     if t == token.LBRACE:
       if nodelist[1][0] == token.RBRACE:
-        return Node('const', { })
+        return Node('dict', ())
       return self.com_dictmaker(nodelist[1])
 
     if t == token.BACKQUOTE:
index b85b498ec8021bafc2649d2cb76304657fa173fd..2fb442a5de12a26a347599cbd0a558de1a43f605 100644 (file)
@@ -656,21 +656,21 @@ class Transformer:
     t = nodelist[0][0]
     if t == token.LPAR:
       if nodelist[1][0] == token.RPAR:
-        n = Node('const', ())
+        n = Node('tuple', ())
         n.lineno = nodelist[0][2]
         return n
       return self.com_node(nodelist[1])
 
     if t == token.LSQB:
       if nodelist[1][0] == token.RSQB:
-        n = Node('const', [ ])
+        n = Node('list', ())
         n.lineno = nodelist[0][2]
         return n
       return self.com_list_constructor(nodelist[1])
 
     if t == token.LBRACE:
       if nodelist[1][0] == token.RBRACE:
-        return Node('const', { })
+        return Node('dict', ())
       return self.com_dictmaker(nodelist[1])
 
     if t == token.BACKQUOTE: