[Python-checkins] CVS: python/dist/src/Tools/compiler/compiler symbols.py,1.4,1.5

Jeremy Hylton jhylton@users.sourceforge.net
Thu, 12 Apr 2001 00:06:28 -0700


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

Modified Files:
	symbols.py 
Log Message:
Only treat an AugAssign as def if its the target is a Name.
Fixes last bug found with test_scope.py.


Index: symbols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/symbols.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** symbols.py	2001/04/12 06:40:42	1.4
--- symbols.py	2001/04/12 07:06:25	1.5
***************
*** 300,306 ****
  
      def visitAugAssign(self, node, scope):
!         # basically, the node is referenced and defined by the same expr
          self.visit(node.node, scope)
!         self.visit(node.node, scope, 1)
          self.visit(node.expr, scope)
  
--- 300,308 ----
  
      def visitAugAssign(self, node, scope):
!         # If the LHS is a name, then this counts as assignment.
!         # Otherwise, it's just use.
          self.visit(node.node, scope)
!         if isinstance(node.node, ast.Name):
!             self.visit(node.node, scope, 1) # XXX worry about this
          self.visit(node.expr, scope)