petehunt/PyMySQL — pull request #96 by brunoqc (2012-01-27 19:24:40+00:00)
Title: Fix ping() when connection is not active.

With MySQL 5.1.41 the exception happened when doing read_packet()

Here's the traceback without the commit :

Traceback (most recent call last):
File "C:\workspaces\python\py-vb-mysql\test-mysql.py", line 8, in
conn.ping(True)
File "c:\workspaces\python\pymysql\pymysql\connections.py", line 641, in ping
[Finished]pkt = self.read_packet()
File "c:\workspaces\python\pymysql\pymysql\connections.py", line 685, in read_packet
packet = packet_type(self)
File "c:\workspaces\python\pymysql\pymysql\connections.py", line 200, in __init__
self.__recv_packet()
File "c:\workspaces\python\pymysql\pymysql\connections.py", line 206, in __recv_packet
raise OperationalError(2013, "Lost connection to MySQL server during query")
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')