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

AttributeError: 'Subscript' object has no attribute 'name' #2250

Closed
tiran opened this issue Jul 4, 2018 · 1 comment
Closed

AttributeError: 'Subscript' object has no attribute 'name' #2250

tiran opened this issue Jul 4, 2018 · 1 comment

Comments

@tiran
Copy link

tiran commented Jul 4, 2018

pylint master fails with AttributeError: 'Subscript' object has no attribute 'name':

  ...
  File ".tox/pylint37/lib/python3.7/site-packages/pylint/utils.py", line 1149, in walk
    cb(astroid)
  File "tox/pylint37/lib/python3.7/site-packages/pylint/checkers/refactoring.py", line 747, in visit_augassign
    self._check_consider_using_join(node)
  File ".tox/pylint37/lib/python3.7/site-packages/pylint/checkers/refactoring.py", line 732, in _check_consider_using_join
    result_assign_names = {target.name for target in assign.targets}
  File ".tox/pylint37/lib/python3.7/site-packages/pylint/checkers/refactoring.py", line 732, in <setcomp>
    result_assign_names = {target.name for target in assign.targets}
AttributeError: 'Subscript' object has no attribute 'name'

The offending code line is https://github.com/tiran/freeipa/blob/pylint2/ipaserver/plugins/migration.py#L806

(Pdb) p vars(assign)
{'lineno': 806, 'col_offset': 12, 'parent': <For l.745 at 0x7f3b0de03198>, 'targets': [<Subscript l.806 at 0x7f3b0de14a90>], 'value': <Const.int l.806 at 0x7f3b0de14a58>, 'type_annotation': None, 'fromlineno': 806, 'tolineno': 806}
(Pdb) p vars(assign.targets[0])
{'ctx': <Context.Store: 2>, 'lineno': 806, 'col_offset': 12, 'parent': <Assign l.806 at 0x7f3b0de14a20>, 'value': <Name.context l.806 at 0x7f3b0de14ac8>, 'slice': <Index l.806 at 0x7f3b0de14b00>, 'fromlineno': 806, 'tolineno': 806}

Steps to reproduce

  1. git clone pylint2 branch from https://github.com/tiran/freeipa/tree/pylint2
  2. run tox -e pylint37

pylint --version output

pylint 2.0.0.dev1
astroid 2.0.0.dev3
Python 3.7.0rc1 (default, Jun 12 2018, 12:42:02) 
@PCManticore
Copy link
Contributor

Thanks for the report, should be fixed in master!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants