[Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pyassem.py,1.17,1.18 pycodegen.py,1.34,1.35

Jeremy Hylton jhylton@users.sourceforge.net
Thu, 12 Apr 2001 10:33:37 -0700


Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv6736/compiler

Modified Files:
	pyassem.py pycodegen.py 
Log Message:
Revise handling of tuple arguments so that the variables names match
those used by compile.c.  (test_grammar now depends on the names)


Index: pyassem.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** pyassem.py	2001/04/12 06:40:42	1.17
--- pyassem.py	2001/04/12 17:33:34	1.18
***************
*** 496,500 ****
          return "TupleArg(%s, %s)" % (self.count, self.names)
      def getName(self):
!         return ".nested%d" % self.count
  
  def getArgCount(args):
--- 496,500 ----
          return "TupleArg(%s, %s)" % (self.count, self.names)
      def getName(self):
!         return ".%d" % self.count
  
  def getArgCount(args):

Index: pycodegen.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** pycodegen.py	2001/04/12 06:52:27	1.34
--- pycodegen.py	2001/04/12 17:33:34	1.35
***************
*** 1102,1110 ****
  
      def generateArgUnpack(self, args):
!         count = 0
!         for arg in args:
              if type(arg) == types.TupleType:
!                 self.emit('LOAD_FAST', '.nested%d' % count)
!                 count = count + 1
                  self.unpackSequence(arg)
                          
--- 1102,1109 ----
  
      def generateArgUnpack(self, args):
!         for i in range(len(args)):
!             arg = args[i]
              if type(arg) == types.TupleType:
!                 self.emit('LOAD_FAST', '.%d' % (i * 2))
                  self.unpackSequence(arg)
                          
***************
*** 1185,1195 ****
      extra = []
      count = 0
!     for elt in arglist:
          if type(elt) == types.StringType:
              args.append(elt)
          elif type(elt) == types.TupleType:
!             args.append(TupleArg(count, elt))
!             count = count + 1
              extra.extend(misc.flatten(elt))
          else:
              raise ValueError, "unexpect argument type:", elt
--- 1184,1195 ----
      extra = []
      count = 0
!     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(i * 2, elt))
              extra.extend(misc.flatten(elt))
+             count = count + 1
          else:
              raise ValueError, "unexpect argument type:", elt