pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.31k stars 1.13k forks source link

Throws exception on 'raise from' in a function #274

Closed pylint-bot closed 8 years ago

pylint-bot commented 10 years ago

Originally reported by: Matt McCredie (BitBucket: blarb, GitHub: @blarb?)


Using:

> pylint --version
No config file found, using default configuration
pylint 1.2.1, 
astroid 1.1.1, common 0.61.0
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2]

the following file - test.py:

#!python
""This file reproduces an error with pylint and Python3"""

def on_error(ex):
    """This function causes issues with pylint."""
    raise Exception("Outer Exception") from ex

when run produces the following :

> pylint test.py
No config file found, using default configuration
Traceback (most recent call last):
  File "/opt/devenv/bin/pylint", line 9, in <module>
    load_entry_point('pylint==1.2.1', 'console_scripts', 'pylint')()
  File "/opt/devenv/lib/python3.4/site-packages/pylint/__init__.py", line 21, in run_pylint
    Run(sys.argv[1:])
  File "/opt/devenv/lib/python3.4/site-packages/pylint/lint.py", line 1051, in __init__
    linter.check(args)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/lint.py", line 626, in check
    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/lint.py", line 712, in check_astroid_module
    walker.walk(astroid)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/utils.py", line 715, in walk
    self.walk(child)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/utils.py", line 715, in walk
    self.walk(child)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/utils.py", line 712, in walk
    cb(astroid)
  File "/opt/devenv/lib/python3.4/site-packages/pylint/checkers/exceptions.py", line 161, in visit_raise
    not inherit_from_std_ex(cause)):
  File "/opt/devenv/lib/python3.4/site-packages/pylint/checkers/exceptions.py", line 297, in inherit_from_std_ex
    for parent in node.ancestors(recurs=False):
TypeError: '_Yes' object is not iterable

pylint-bot commented 10 years ago

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


Thanks for the report. Could you try the version from the repo? I fixed it there after the release of 1.2.1.

pylint-bot commented 10 years ago

Original comment by Matt McCredie (BitBucket: blarb, GitHub: @blarb?):


Yes, the issue seems to be gone if I download the tip. Thanks