Tue, 09 Jul 2019 19:08:24 +0200
MiscellaneousChecker: changed code to cope with some strange situation where the arguments of a function definition don't have the kw_defaults attribute (AST).
eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py | file | annotate | diff | comparison | revisions |
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Tue Jul 09 19:07:03 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Tue Jul 09 19:08:24 2019 +0200 @@ -760,7 +760,12 @@ for node in ast.walk(self.__tree): if any(isinstance(node, functionDef) for functionDef in functionDefs): - for default in node.args.defaults + node.args.kw_defaults: + defaults = node.args.defaults[:] + try: + defaults += node.args.kw_defaults[:] + except AttributeError: + pass + for default in defaults: if any(isinstance(default, mutableType) for mutableType in mutableTypes): typeName = type(default).__name__