diff --git a/pymysql/connections.py b/pymysql/connections.py index 1e44d05..d22c8a6 100644 --- a/pymysql/connections.py +++ b/pymysql/connections.py @@ -548,7 +548,7 @@ class Connection(object): def _config(key, default): try: return cfg.get(read_default_group,key) - except: + except Exception: return default user = _config("user",user) diff --git a/pymysql/cursors.py b/pymysql/cursors.py index b1651a1..ec2a735 100644 --- a/pymysql/cursors.py +++ b/pymysql/cursors.py @@ -55,7 +55,7 @@ class Cursor(object): try: while self.nextset(): pass - except: + except Exception: pass self.connection = None @@ -324,7 +324,7 @@ class SSCursor(Cursor): try: if self._has_next: while self.nextset(): pass - except: pass + except Exception: pass def _query(self, q): conn = self._get_db() diff --git a/pymysql/tests/test_SSCursor.py b/pymysql/tests/test_SSCursor.py index 5ca4068..bb4a855 100644 --- a/pymysql/tests/test_SSCursor.py +++ b/pymysql/tests/test_SSCursor.py @@ -3,7 +3,7 @@ import sys try: from pymysql.tests import base import pymysql.cursors -except: +except Exception: # For local testing from top-level directory, without installing sys.path.append('../pymysql') from pymysql.tests import base diff --git a/pymysql/tests/test_issues.py b/pymysql/tests/test_issues.py index 01dc0e2..d768e8b 100644 --- a/pymysql/tests/test_issues.py +++ b/pymysql/tests/test_issues.py @@ -159,7 +159,7 @@ class TestNewIssues(base.PyMySQLTestCase): self.fail() except pymysql.OperationalError as e: self.assertEqual(2003, e.args[0]) - except: + except Exception: self.fail() def test_issue_33(self): @@ -202,7 +202,7 @@ class TestNewIssues(base.PyMySQLTestCase): try: c.execute("show tables") self.fail() - except: + except Exception: pass # check the process list from the other connection try: diff --git a/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py b/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py index feaffcd..f84c1c0 100644 --- a/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py +++ b/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py @@ -52,7 +52,7 @@ class DatabaseTest(unittest.TestCase): def table_exists(self, name): try: self.cursor.execute('select * from %s where 1=0' % name) - except: + except Exception: return False else: return True