tonybaloney/perflint

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

hugovk opened this issue · 2 comments

I think this belongs here, but please let me know if it should go to pylint instead.

Python 3.10.2
macOS Monterey
pylint==2.12.2
perflint==0.0.9

$ git clone https://github.com/python-pillow/Pillow
...
$ cd Pillow
$ pylint src/PIL/PngImagePlugin.py
...

-----------------------------------
Your code has been rated at 6.99/10

$ pylint src/PIL/PngImagePlugin.py  --load-plugins=perflint
...
Exception on node <Subscript l.1136 at 0x104ca3bb0> in file '/private/tmp/Pillow/src/PIL/PngImagePlugin.py'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/perflint/for_loop_checker.py", line 248, in visit_subscript
    inferred_value = local_type(node.value)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/perflint/for_loop_checker.py", line 19, in local_type
    if name.name in name.frame().locals:
AttributeError: 'Subscript' object has no attribute 'name'
src/PIL/PngImagePlugin.py:1:0: F0001: Fatal error while checking 'src/PIL/PngImagePlugin.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/Users/huvankem/Library/Caches/pylint/pylint-crash-2022-03-01-17.txt'. (fatal)

------------------------------------------------------------------
Your code has been rated at 6.02/10 (previous run: 6.99/10, -0.97)

Here's the crash file:

pylint-crash-2022-03-01-17.txt

I fixed that in 0.1.0. thanks for the report.

lmk if the update doesn't work

Thanks, confirmed fixed!