You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a virtual environment, install Openstack's keystoneauth1 package: pip install keystoneauth1==3.2.0
Create a small Python file:
"""asdf"""fromkeystoneauth1importexceptions# create a predefined tuple constant of exceptions to catchCONNECTION_FAILURE_EXCEPTIONS= (
exceptions.connection.ConnectFailure,
exceptions.connection.UnknownConnectionError,
)
try:
raiseexceptions.connection.ConnectFailure('Oops :(')
# try to catch the tuple of exceptions, which is valid Python.exceptCONNECTION_FAILURE_EXCEPTIONSasexc:
print'Something bad happened! {}'.format(exc)
Run pylint test.py
Current behavior
When running pylint on the above test file, it reports a catching-non-exception error for the tuple given:
E: 15, 7: Catching an exception which doesn't inherit from Exception: CONNECTION_FAILURE_EXCEPTIONS (catching-non-exception)
Expected behavior
I would expect that error not to be present. Consider the following similar example:
I'm not sure why this is failing under the circumstances. I have ensured that both of the Openstack Keystone Exception classes are indeed inheriting from Exception. Passing in a literal tuple of the keystone exceptions works as expected, but having a variable of the same tuple does not. I would imagine that the tuple traversal is failing or not going deep enough to determine if the classes inherit from Exception or BaseException.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
pip install keystoneauth1==3.2.0
pylint test.py
Current behavior
When running pylint on the above test file, it reports a
catching-non-exception
error for the tuple given:Expected behavior
I would expect that error not to be present. Consider the following similar example:
When pylint is run on the above code, it doesn't report foul play on the
EXCEPTIONS
tuple.pylint --version output
pylint 1.7.4,
astroid 1.5.3
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
I'm not sure why this is failing under the circumstances. I have ensured that both of the Openstack Keystone Exception classes are indeed inheriting from
Exception
. Passing in a literal tuple of the keystone exceptions works as expected, but having a variable of the same tuple does not. I would imagine that the tuple traversal is failing or not going deep enough to determine if the classes inherit fromException
orBaseException
.The text was updated successfully, but these errors were encountered: