Index: tree.py
===================================================================
--- tree.py	(revision 34940)
+++ tree.py	(working copy)
@@ -75,7 +75,7 @@
     def __str__(self):
         return "could not visit %s" % (self.node, )
 
-def make_dispatch_function(dispatch_table):
+def make_dispatch_function(dispatch_table, attr):
     code = ["def dispatch(self, node):"]
     code.append("    if isinstance(node, Nonterminal):")
     code.append("        if node.symbol not in self.dispatch_table:")
@@ -102,11 +102,15 @@
     code.append("        else:")
     code.append("            return self.dispatch_table[node.symbol](self, node)")
     code.append("    raise VisitError(node)")
-    exec py.code.Source("\n".join(code)).compile()
+    exec py.code.Source("\n".join(code).replace('dispatch_table', attr)).compile()
     return dispatch
 
+foo = 0
+
 class CreateDispatchDictionaryMetaclass(type):
     def __new__(cls, name_, bases, dct):
+        global foo
+        foo += 1
         dispatch_table = {}
         for name, value in dct.iteritems():
             if name.startswith("visit_"):
@@ -116,8 +120,9 @@
                         "general_visit"]:
             if special in dct:
                 dispatch_table["__" + special] = dct[special]
-        dct["dispatch_table"] = dispatch_table
-        dct["dispatch"] = make_dispatch_function(dispatch_table)
+        attr = "dispatch_table" + str(foo)
+        dct[attr] = dispatch_table
+        dct["dispatch"] = make_dispatch_function(dispatch_table, attr)
         return type.__new__(cls, name_, bases, dct)
 
 class RPythonVisitor(object):
