I've a similar problem with one of the test cases (mentioned in note #4) and found a fix. It seems that for Python 3, it's good to have __del__ and call close(). I'm not sure it will help you, but please can you patch and see if it works for you?
The change goes in MySQLConnection:
class MySQLConnection(object):
def __del__(self):
self.close()
Test case involves assigning a new connection to a connection still in use, which did not commit changes for example:
cnx = mysql.connector.connection.MySQLConnection(**config)
cur = cnx.cursor()
cur.execute("DROP TABLE IF EXISTS t1")
cur.execute("CREATE TABLE t1 (c1 INT)")
cur.execute("INSERT INTO t1 (c1) VALUES (1)")
cnx = mysql.connector.connection.MySQLConnection(**config)
cur = cnx.cursor()
cur.execute("DROP TABLE IF EXISTS t1")
I'm adding a explicit __del__-destructor to Python 2 code as well.
@Dillon
I've a similar problem with one of the test cases (mentioned in note #4) and found a fix. It seems that for Python 3, it's good to have __del__ and call close(). I'm not sure it will help you, but please can you patch and see if it works for you?
The change goes in MySQLConnection:
class MySQLConnection (object) :
def __del__(self):
self.close()
Test case involves assigning a new connection to a connection still in use, which did not commit changes for example:
cnx = mysql.connector .connection. MySQLConnection (**config) execute( "DROP TABLE IF EXISTS t1") execute( "CREATE TABLE t1 (c1 INT)") execute( "INSERT INTO t1 (c1) VALUES (1)") .connection. MySQLConnection (**config) execute( "DROP TABLE IF EXISTS t1")
cur = cnx.cursor()
cur.
cur.
cur.
cnx = mysql.connector
cur = cnx.cursor()
cur.
I'm adding a explicit __del__-destructor to Python 2 code as well.