Commits

Tarek Ziadé committed a144ea3

more weird edge cases py2/3

  • Participants
  • Parent commits 13d068a

Comments (0)

Files changed (2)

flake8/pyflakes.py

     def EXCEPTHANDLER(self, node):
 
         if node.name is not None:
-            self.addBinding(node.lineno, Assignment(node.name, node))
+            if isinstance(node.name, str):
+                name = node.name
+            else:
+                name = node.name.id
+            self.addBinding(node.lineno, Assignment(name, node))
 
         def runException():
             for stmt in node.body:

flake8/tests/test_flakes.py

 try:
     pass
 except ValueError:
-    print(err)
+    print("err")
 
 try:
     pass
 except ValueError:
-    print(err)
+    print("err")
+"""
+
+code3 = """
+try:
+    pass
+except (ImportError, ValueError):
+    print("err")
 """
 
 
 class TestFlake(TestCase):
 
     def test_exception(self):
-        for c in (code, code2):
+        for c in (code, code2, code3):
             warnings = check(code)
-            self.assertEqual(warnings, 0)
+            self.assertEqual(warnings, 0, code)