Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.13 crashed with AttributeError: 'Call' object has no attribute 'name' #5969

Closed
skirpichev opened this issue Mar 25, 2022 · 6 comments · Fixed by #5986
Closed

2.13 crashed with AttributeError: 'Call' object has no attribute 'name' #5969

skirpichev opened this issue Mar 25, 2022 · 6 comments · Fixed by #5986
Assignees
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@skirpichev
Copy link
Contributor

Bug description

I got the following traceback from the project CI:


Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 73, in walk
    callback(astroid)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 61, in visit_for
    self._modified_iterating_check_on_node_and_children(body_node, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 69, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check_on_node_and_children(child, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 69, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check_on_node_and_children(child, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 67, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check(body_node, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 75, in _modified_iterating_check
    if self._modified_iterating_list_cond(node, iter_obj):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 124, in _modified_iterating_list_cond
    self._common_cond_list_set(node, iter_obj, infer_val)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 105, in _common_cond_list_set
    node.value.func.expr.name == iter_obj.name
AttributeError: 'Call' object has no attribute 'name'
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/parallel.py", line 80, in _worker_check_single_file
    _worker_linter.check_single_file_item(file_item)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1100, in check_single_file_item
    self._check_file(self.get_ast, check_astroid_module, file)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1146, in _check_file
    check_astroid_module(ast_node)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1298, in check_astroid_module
    retval = self._check_astroid_module(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1345, in _check_astroid_module
    walker.walk(node)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  [Previous line repeated 1 more time]
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 73, in walk
    callback(astroid)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 61, in visit_for
    self._modified_iterating_check_on_node_and_children(body_node, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 69, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check_on_node_and_children(child, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 69, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check_on_node_and_children(child, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 67, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check(body_node, iter_obj)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 75, in _modified_iterating_check
    if self._modified_iterating_list_cond(node, iter_obj):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 124, in _modified_iterating_list_cond
    self._common_cond_list_set(node, iter_obj, infer_val)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 105, in _common_cond_list_set
    node.value.func.expr.name == iter_obj.name
AttributeError: 'Call' object has no attribute 'name'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/__init__.py", line 22, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/run.py", line 358, in __init__
    linter.check(args)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1077, in check
    check_parallel(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/pylint/lint/parallel.py", line 157, in check_parallel
    for (
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/multiprocessing/pool.py", line 870, in next
    raise value
AttributeError: 'Call' object has no attribute 'name'

Configuration

See pyproject.toml in the Diofant repo

Command used

pylint diofant

Pylint output

Traceback (see above)

Expected behavior

No crash

Pylint version

pylint 2.13.0
astroid 2.11.1
CPython 3.10.2

OS / Environment

No response

Additional dependencies

No response

@skirpichev skirpichev added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 25, 2022
skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 25, 2022
skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 25, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 25, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.1 milestone Mar 25, 2022
skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 25, 2022
@DanielNoord
Copy link
Collaborator

@orSolocate This is a regression in the new checker you added. Are you willing to take look? Please feel free to say no, then somebody else will take a look!

@orSolocate
Copy link
Contributor

@DanielNoord - thanks for letting me know.
@skirpichev - thanks for discovering it. Will be harder to reproduce without knowing which line caused the crash... could you try to provide it?

I will try to reproduce it with some other node which node.value.func.expr is a Call node..

@jdavidagudelo
Copy link

This code was the one I used to reproduce this issue:

def format_manifest_serializer_errors(errors):
    errors_messages = []
    for key, value in errors.items():
        for message in format_manifest_serializer_errors(value):
            error_message = f"{key}: {message}"
            errors_messages.append(error_message)
    return errors_messages

skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 26, 2022
@skirpichev
Copy link
Contributor Author

Will be harder to reproduce without knowing which line caused the crash... could you try to provide it?

It seems, the problem file is diofant/polys/factortools.py and related to the _gf_berlekamp() method. @orSolocate, sorry for an incomplete issue.

Unfortunately, tracebacks from parallel runs aren't very helpful. Even the problem file is missing, c.f. this run with -j1.

I would consider this as an issue. (I've not found related bugreports so far.) Or is this a feature?

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Mar 26, 2022

Unfortunately, tracebacks from parallel runs aren't very helpful. Even the problem file is missing, c.f. this run with -j1.

I would consider this as an issue. (I've not found related bugreports so far.) Or is this a feature?

No the report not being generated while running in parallel is an issue. Probably due to multiple threads writing the same file together as we try to create only one file (?) The error message saying why we can't write not being shown is also an issue but this should be easy to fix in 2.13.1.

orSolocate added a commit to orSolocate/pylint that referenced this issue Mar 26, 2022
… the list/dict/set being iterated through is a function call.
@orSolocate
Copy link
Contributor

I uploaded a fix for that. added your example as a regression test and also verified the factortools.py fails before the fix and doesn't fail after the fix :)

Pierre-Sassoulas added a commit that referenced this issue Mar 26, 2022
When the list/dict/set being iterated through is a function call.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Pierre-Sassoulas added a commit that referenced this issue Mar 26, 2022
When the list/dict/set being iterated through is a function call.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants