- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 305
 
Description
Steps to reproduce
The following code triggers a TypeError in astroid:
a = {{}} > 0This bug was discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60641 (report not public yet)
Current behavior
Exception on node <AssignName.a l.1 at 0x7d1710ba9310> in file 'corpus/a.py'
Traceback (most recent call last):
  File "pylint/pylint/checkers/utils.py", line 1365, in safe_infer
    value = next(infer_gen)
            ^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_classes.py", line 1926, in _infer
    retval = self._do_compare(lhs, op, rhs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_classes.py", line 1894, in _do_compare
    left, right = self._to_literal(left), self._to_literal(right)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_classes.py", line 1862, in _to_literal
    return ast.literal_eval(node.as_string())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ast.py", line 112, in literal_eval
    return _convert(node_or_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ast.py", line 94, in _convert
    return set(map(_convert, node.elts))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'dict'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "pylint/pylint/checkers/base/name_checker/checker.py", line 423, in visit_assignname
    inferred_assign_type = utils.safe_infer(assign_type.value)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pylint/pylint/checkers/utils.py", line 1369, in safe_infer
    raise AstroidError from e
astroid.exceptions.AstroidError
Expected behavior
No crash