summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 17:33:34 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 17:33:34 (GMT)
commitbfb0cf822bedb25c38fa7f411af83d6654872dd4 (patch)
tree702092697a211956c2a864f25a17625d21d45a77
parente20bd19f86bfcb4f3862cdfa5f56c9e48012cced (diff)
downloadcpython-bfb0cf822bedb25c38fa7f411af83d6654872dd4.zip
cpython-bfb0cf822bedb25c38fa7f411af83d6654872dd4.tar.gz
cpython-bfb0cf822bedb25c38fa7f411af83d6654872dd4.tar.bz2
Revise handling of tuple arguments so that the variables names match
those used by compile.c. (test_grammar now depends on the names)
-rw-r--r--Lib/compiler/pyassem.py2
-rw-r--r--Lib/compiler/pycodegen.py14
-rw-r--r--Tools/compiler/compiler/pyassem.py2
-rw-r--r--Tools/compiler/compiler/pycodegen.py14
4 files changed, 16 insertions, 16 deletions
diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py
index 447a8e7..15e91f4 100644
--- a/Lib/compiler/pyassem.py
+++ b/Lib/compiler/pyassem.py
@@ -495,7 +495,7 @@ class TupleArg:
def __repr__(self):
return "TupleArg(%s, %s)" % (self.count, self.names)
def getName(self):
- return ".nested%d" % self.count
+ return ".%d" % self.count
def getArgCount(args):
argcount = len(args)
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index c0bbed3..691232f 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -1101,11 +1101,10 @@ class AbstractFunctionCode:
self.emit('RETURN_VALUE')
def generateArgUnpack(self, args):
- count = 0
- for arg in args:
+ for i in range(len(args)):
+ arg = args[i]
if type(arg) == types.TupleType:
- self.emit('LOAD_FAST', '.nested%d' % count)
- count = count + 1
+ self.emit('LOAD_FAST', '.%d' % (i * 2))
self.unpackSequence(arg)
def unpackSequence(self, tup):
@@ -1184,13 +1183,14 @@ def generateArgList(arglist):
args = []
extra = []
count = 0
- for elt in arglist:
+ for i in range(len(arglist)):
+ elt = arglist[i]
if type(elt) == types.StringType:
args.append(elt)
elif type(elt) == types.TupleType:
- args.append(TupleArg(count, elt))
- count = count + 1
+ args.append(TupleArg(i * 2, elt))
extra.extend(misc.flatten(elt))
+ count = count + 1
else:
raise ValueError, "unexpect argument type:", elt
return args + extra, count
diff --git a/Tools/compiler/compiler/pyassem.py b/Tools/compiler/compiler/pyassem.py
index 447a8e7..15e91f4 100644
--- a/Tools/compiler/compiler/pyassem.py
+++ b/Tools/compiler/compiler/pyassem.py
@@ -495,7 +495,7 @@ class TupleArg:
def __repr__(self):
return "TupleArg(%s, %s)" % (self.count, self.names)
def getName(self):
- return ".nested%d" % self.count
+ return ".%d" % self.count
def getArgCount(args):
argcount = len(args)
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py
index c0bbed3..691232f 100644
--- a/Tools/compiler/compiler/pycodegen.py
+++ b/Tools/compiler/compiler/pycodegen.py
@@ -1101,11 +1101,10 @@ class AbstractFunctionCode:
self.emit('RETURN_VALUE')
def generateArgUnpack(self, args):
- count = 0
- for arg in args:
+ for i in range(len(args)):
+ arg = args[i]
if type(arg) == types.TupleType:
- self.emit('LOAD_FAST', '.nested%d' % count)
- count = count + 1
+ self.emit('LOAD_FAST', '.%d' % (i * 2))
self.unpackSequence(arg)
def unpackSequence(self, tup):
@@ -1184,13 +1183,14 @@ def generateArgList(arglist):
args = []
extra = []
count = 0
- for elt in arglist:
+ for i in range(len(arglist)):
+ elt = arglist[i]
if type(elt) == types.StringType:
args.append(elt)
elif type(elt) == types.TupleType:
- args.append(TupleArg(count, elt))
- count = count + 1
+ args.append(TupleArg(i * 2, elt))
extra.extend(misc.flatten(elt))
+ count = count + 1
else:
raise ValueError, "unexpect argument type:", elt
return args + extra, count