UtilitiesPython2/py2flakes/checker.py

changeset 2088
73a2ca4ac409
parent 1544
d06ffad32855
child 2302
f29e9405c851
--- a/UtilitiesPython2/py2flakes/checker.py	Tue Oct 02 19:53:31 2012 +0200
+++ b/UtilitiesPython2/py2flakes/checker.py	Wed Oct 03 12:18:51 2012 +0200
@@ -285,21 +285,24 @@
                 isinstance(node.value, _ast.Str))
 
     def handleNode(self, node, parent):
-        node.parent = parent
-        if self.traceTree:
-            print '  ' * self.nodeDepth + node.__class__.__name__
-        self.nodeDepth += 1
-        if self.futuresAllowed and not \
-               (isinstance(node, _ast.ImportFrom) or self.isDocstring(node)):
-            self.futuresAllowed = False
-        nodeType = node.__class__.__name__.upper()
-        try:
-            handler = getattr(self, nodeType)
-            handler(node)
-        finally:
-            self.nodeDepth -= 1
-        if self.traceTree:
-            print '  ' * self.nodeDepth + 'end ' + node.__class__.__name__
+        if node:
+            node.parent = parent
+            if self.traceTree:
+                print '  ' * self.nodeDepth + node.__class__.__name__
+            self.nodeDepth += 1
+            if self.futuresAllowed and not \
+                   (isinstance(node, _ast.ImportFrom) or self.isDocstring(node)):
+                self.futuresAllowed = False
+            nodeType = node.__class__.__name__.upper()
+            try:
+                handler = getattr(self, nodeType)
+                handler(node)
+            except AttributeError:
+                print nodeType, "not supported yet. Please report this."
+            finally:
+                self.nodeDepth -= 1
+            if self.traceTree:
+                print '  ' * self.nodeDepth + 'end ' + node.__class__.__name__
 
     def ignore(self, node):
         pass

eric ide

mercurial