1.1 --- a/common.py Tue Dec 13 17:57:33 2016 +0100
1.2 +++ b/common.py Tue Dec 13 17:58:26 2016 +0100
1.3 @@ -395,7 +395,7 @@
1.4 for i, node in enumerate(n.nodes):
1.5 assignments.append(
1.6 compiler.ast.Assign([node], compiler.ast.Subscript(
1.7 - compiler.ast.Name(temp), "OP_APPLY", [compiler.ast.Const(i)]))
1.8 + compiler.ast.Name(temp), "OP_APPLY", [compiler.ast.Const(i, str(i))]))
1.9 )
1.10
1.11 return self.process_structure_node(compiler.ast.Stmt(assignments))
2.1 --- a/compiler/ast.py Tue Dec 13 17:57:33 2016 +0100
2.2 +++ b/compiler/ast.py Tue Dec 13 17:58:26 2016 +0100
2.3 @@ -502,8 +502,9 @@
2.4 return "%s %s" % (self.expr, " ".join([("%s %s" % op) for op in self.ops]))
2.5
2.6 class Const(Node):
2.7 - def __init__(self, value, lineno=None):
2.8 + def __init__(self, value, literal=None, lineno=None):
2.9 self.value = value
2.10 + self.literal = literal
2.11 self.lineno = lineno
2.12
2.13 def getChildren(self):
2.14 @@ -513,7 +514,7 @@
2.15 return ()
2.16
2.17 def __repr__(self):
2.18 - return "Const(%r)" % (self.value,)
2.19 + return "Const(%r, %r)" % (self.value, self.literal)
2.20
2.21 def __str__(self):
2.22 return repr(self.value)
3.1 --- a/compiler/transformer.py Tue Dec 13 17:57:33 2016 +0100
3.2 +++ b/compiler/transformer.py Tue Dec 13 17:58:26 2016 +0100
3.3 @@ -742,7 +742,7 @@
3.4 def atom_number(self, nodelist):
3.5 ### need to verify this matches compile.c
3.6 k = eval(nodelist[0][1])
3.7 - return Const(k, lineno=nodelist[0][2])
3.8 + return Const(k, nodelist[0][1], lineno=nodelist[0][2])
3.9
3.10 def decode_literal(self, lit):
3.11 if self.encoding:
3.12 @@ -759,7 +759,7 @@
3.13 k = ''
3.14 for node in nodelist:
3.15 k += self.decode_literal(node[1])
3.16 - return Const(k, lineno=nodelist[0][2])
3.17 + return Const(k, node[1], lineno=nodelist[0][2])
3.18
3.19 def atom_name(self, nodelist):
3.20 return Name(nodelist[0][1], lineno=nodelist[0][2])