Open
Description
Steps to reproduce
The following code triggers a TypeError
in astroid:
a=random.sample(1*[b], 1)
This bug was discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64604 (report not public yet)
Current behavior
Exception on node <AssignName.a l.1 at 0x7bc0fed59340> 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 147, in infer
for result in self._explicit_inference(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "astroid/astroid/inference_tip.py", line 70, in inner
raise e from None
File "astroid/astroid/inference_tip.py", line 66, in inner
func(node, context, **kwargs)
File "astroid/astroid/brain/brain_random.py", line 84, in infer_random_sample
_clone_node_with_lineno(elt, parent=new_node, lineno=new_node.lineno)
File "astroid/astroid/brain/brain_random.py", line 41, in _clone_node_with_lineno
postinit_params = {param: getattr(node, param) for param in _astroid_fields}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'UninferableBase' object is not iterable
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