re-raising an exception causes E0702 #1419

Closed
smoser opened this Issue Apr 14, 2017 · 0 comments

Comments

Projects
None yet
1 participant

smoser commented Apr 14, 2017

Steps to reproduce

  1. myshow

     $ cat > myshow.py <<EOF
     #!/usr/bin/python3
     """foo"""
     try:
         int("9a")
     except ValueError as exc:
         print("apparently 9a is not an integer: %s" % exc)
         print("Exc is a: %r" % exc)
         raise exc
     EOF
    
  2. run pylint

     $ python -m pylint \
        '--msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \
         --output-format=text --rcfile=/dev/null myshow.py
     ************* Module myshow
     myshow.py:7: [E0702(raising-bad-type), ] Raising ValueError while only classes or instances are allowed
    

Current behavior

Complain that the raised value is a bad type.

Expected behavior

exc in the above is an instance of ValueError. What is wrong with raising it ?

pylint --version output

__main__.py 1.7.0, 
astroid 1.5.1
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609]

PCManticore added a commit that referenced this issue Apr 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment