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

Crash: AttributeError: 'Call' object has no attribute 'name' #8598

Closed
Dpeta opened this issue Apr 20, 2023 · 2 comments · Fixed by #8678
Closed

Crash: AttributeError: 'Call' object has no attribute 'name' #8598

Dpeta opened this issue Apr 20, 2023 · 2 comments · Fixed by #8678
Assignees
Labels
Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@Dpeta
Copy link

Dpeta commented Apr 20, 2023

Bug description

Crash when parsing the following convo.py: https://github.com/Dpeta/pesterchum-alt-servers/blob/62f3e21bd4699b04050b1d9ab3838aab9b2db28a/convo.py

Happens with 2.17.2 and 3.0.0a6.

Command used

python -m pylint convo.py

Pylint output

pylint crashed with a ``AstroidError`` and with the following stacktrace:
Traceback (most recent call last):
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 772, in _lint_file
    check_astroid_module(module)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1001, in check_astroid_module
    retval = self._check_astroid_module(
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1047, in _check_astroid_module
    walker.walk(node)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 60, in visit_for
    self._modified_iterating_check_on_node_and_children(body_node, iter_obj)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 66, in _modified_iterating_check_on_node_and_children
    self._modified_iterating_check(body_node, iter_obj)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/checkers/modified_iterating_checker.py", line 96, in _modified_iterating_check
    obj_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 "/home/user/pchumenv/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 736, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "/home/user/pchumenv/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 774, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Expected behavior

No crash.

Pylint version

pylint 3.0.0a6
astroid 2.15.3
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]

OS / Environment

Arch Linux

Additional dependencies

PyQt6

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine labels Apr 21, 2023
@nickdrozd
Copy link
Collaborator

nickdrozd commented Apr 21, 2023

Minimal reproducing example:

class PesterText:
    def __init__(self):
        self.urls = {}

class PesterConvo:
    def __init__(self):
        self.textArea = PesterText()

    def closeEvent(self, event):
        for movie in self.textArea.urls.copy():
            del movie

@nickdrozd nickdrozd removed the Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine label Apr 21, 2023
@Pierre-Sassoulas Pierre-Sassoulas added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Apr 21, 2023
@nickdrozd
Copy link
Collaborator

Here's an even minimal-er reproducer:

for var in {}.copy():
    del var

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 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants