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

Pylint 2.9.4 failure for 'Subscript' object has no attribute 'attrname' #4732

Closed
gmcluhan opened this issue Jul 20, 2021 · 3 comments · Fixed by #4733
Closed

Pylint 2.9.4 failure for 'Subscript' object has no attribute 'attrname' #4732

gmcluhan opened this issue Jul 20, 2021 · 3 comments · Fixed by #4733
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@gmcluhan
Copy link

gmcluhan commented Jul 20, 2021

Steps to reproduce

  1. Run pylint against the code below
import subprocess

if index == 0:
    pobjs[index] = subprocess.Popen(
        commd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )

Current behavior

Pylint is failing to properly lint this file.

Exception on node <Assign l.51 at 0x7f1c81969100> in file 'our_file.py'
     multiprocessing.pool.RemoteTraceback: 
     """
     Traceback (most recent call last):
       File "/.pyenv/versions/3.9.0/lib/python3.9/multiprocessing/pool.py", line 125, in worker
         result = (True, func(*args, **kwds))
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/lint/parallel.py", line 69, in _worker_check_single_file
         _worker_linter.check_single_file(name, filepath, modname)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 994, in check_single_file
         self._check_file(
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1035, in _check_file
         check_astroid_module(ast_node)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1172, in check_astroid_module
         retval = self._check_astroid_module(
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1217, in _check_astroid_module
         walker.walk(ast_node)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
         self.walk(child)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
         self.walk(child)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
         self.walk(child)
       [Previous line repeated 3 more times]
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 74, in walk
         callback(astroid)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1352, in visit_assign
         self._append_context_managers_to_stack(node)
       File "/workspace/.tox/lint39/lib/python3.9/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1416, in _append_context_managers_to_stack
         else assignee.attrname
     AttributeError: 'Subscript' object has no attribute 'attrname'
     """

Expected behavior

This should pass, it only fails in our Python 3.9 environment. It passes in 3.8.

pylint --version output

Result of pylint --version output:

2.9.4
@cdce8p cdce8p added the Crash 💥 A bug that makes pylint crash label Jul 20, 2021
@cdce8p
Copy link
Member

cdce8p commented Jul 20, 2021

I can reproduce it. It's likely caused by #4721. @DudeNr33 would you mind taking a look?

@DudeNr33
Copy link
Collaborator

Will look at it as soon as possible.

@cdce8p
Copy link
Member

cdce8p commented Jul 21, 2021

@DudeNr33 Thank you! 🐬

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
4 participants