pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

AttributeError when parsing #128

Closed pylint-bot closed 8 years ago

pylint-bot commented 10 years ago

Originally reported by: Luca Wehrstedt (BitBucket: lerks, GitHub: @lerks?)


With the following snippet:

#!python

with open("") as a.b:
    c.d()
    c = None

I'm getting the following error:

#!python

Traceback (most recent call last):
  File "/usr/bin/pylint2", line 3, in <module>
    run_pylint()
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/__init__.py", line 21, in run_pylint
    Run(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/lint.py", line 1040, in __init__
    linter.check(args)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/lint.py", line 626, in check
    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/lint.py", line 712, in check_astroid_module
    walker.walk(astroid)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 697, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 697, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 697, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 697, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 697, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/utils.py", line 694, in walk
    cb(astroid)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/checkers/variables.py", line 512, in visit_name
    and not is_defined_before(node)
  File "/usr/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg/pylint/checkers/utils.py", line 158, in is_defined_before
    if vars and vars.name == varname:
AttributeError: 'AssAttr' object has no attribute 'name'

I tested it on the latest pylint and astroid tips.


pylint-bot commented 10 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Hi! Thanks for the report!

Here's a pull request which fixes this crash: https://bitbucket.org/logilab/pylint/pull-request/79/fix-bitbucket-126-dont-crash-when/diff. I'll wait a couple more days to merge it (or wait for Sylvain to have a look).

pylint-bot commented 10 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Hi! This was fixed in the tip (changeset 0a09e67). Thanks!