SimplifyNodeVisitor: fixed an issue in the Y105 message for multiple exceptions.

Thu, 15 Apr 2021 16:50:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 15 Apr 2021 16:50:23 +0200
changeset 8241
de2ebf20d822
parent 8240
93b8a353c4bf
child 8242
aa713ac50c0d

SimplifyNodeVisitor: fixed an issue in the Y105 message for multiple exceptions.

eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py file | annotate | diff | comparison | revisions
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py	Wed Apr 14 19:59:16 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py	Thu Apr 15 16:50:23 2021 +0200
@@ -542,6 +542,9 @@
         ):
             if node.handlers[0].type is None:
                 exception = "Exception"
+            elif isinstance(node.handlers[0].type, ast.Tuple):
+                exception = ", ".join(
+                    [unparse(n) for n in node.handlers[0].type.elts])
             else:
                 exception = unparse(node.handlers[0].type)
             self.__error(node.lineno - 1, node.col_offset, "Y105", exception)

eric ide

mercurial