[Zope-Checkins] CVS: Packages/RestrictedPython - MutatingWalker.py:1.3 RestrictionMutator.py:1.7

Evan Simpson evan@zope.com
Tue, 13 Nov 2001 17:42:05 -0500


Update of /cvs-repository/Packages/RestrictedPython
In directory cvs.zope.org:/tmp/cvs-serv698

Modified Files:
	MutatingWalker.py RestrictionMutator.py 
Log Message:
Add test and fix for default argument processing in sub-functions.


=== Packages/RestrictedPython/MutatingWalker.py 1.2 => 1.3 ===
         self._cache = {}
 
-    def defaultVisitNode(self, node, walker=None):
+    def defaultVisitNode(self, node, walker=None, exclude=None):
         for name, child in node.__dict__.items():
+            if exclude is not None and name in exclude:
+                continue
             v = self.dispatchObject(child)
             if v is not child:
                 # Replace the node.


=== Packages/RestrictedPython/RestrictionMutator.py 1.6 => 1.7 ===
         for argname in node.argnames:
             self.checkName(node, argname)
+        walker.visitSequence(node.defaults)
 
         former_funcinfo = self.funcinfo
         self.funcinfo = FuncInfo()
-        node = walker.defaultVisitNode(node)
+        node = walker.defaultVisitNode(node, exclude=('defaults',))
         self.prepBody(node.code.nodes)
         self.funcinfo = former_funcinfo
         return node