Skip to content

Commit 15eaee5

Browse files
authored
Close connection on unknown error (PyMySQL#759)
Fixes PyMySQL#275
1 parent 7b18bb6 commit 15eaee5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pymysql/connections.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,10 @@ def _read_bytes(self, num_bytes):
694694
raise err.OperationalError(
695695
CR.CR_SERVER_LOST,
696696
"Lost connection to MySQL server during query (%s)" % (e,))
697+
except BaseException:
698+
# Don't convert unknown exception to MySQLError.
699+
self._force_close()
700+
raise
697701
if len(data) < num_bytes:
698702
self._force_close()
699703
raise err.OperationalError(

0 commit comments

Comments
 (0)