diff --git a/src/pylint_odoo/checkers/odoo_addons.py b/src/pylint_odoo/checkers/odoo_addons.py index 04c0beb6..0d69ce13 100644 --- a/src/pylint_odoo/checkers/odoo_addons.py +++ b/src/pylint_odoo/checkers/odoo_addons.py @@ -1029,7 +1029,12 @@ def visit_dict(self, node): node.parent, nodes.Expr ): return - manifest_dict = ast.literal_eval(node.as_string()) + try: + manifest_dict = ast.literal_eval(node.as_string()) + except ValueError: + # There is code that the node is formed but literal_eval raises error + # e.g. {"key": "" or ""} + return manifest_keys_nodes = { key_node.value: key_node for key_node, _value in node.items if isinstance(key_node, nodes.Const) } diff --git a/testing/resources/test_repo/broken_module3/__manifest__.py b/testing/resources/test_repo/broken_module3/__manifest__.py new file mode 100644 index 00000000..594b8093 --- /dev/null +++ b/testing/resources/test_repo/broken_module3/__manifest__.py @@ -0,0 +1,4 @@ +# Verify a dictionary parsed correctly as node but raising error as literal_eval +{ + "key": "" or "", +} \ No newline at end of file