mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 20:33:57 +08:00
Mark connection open, even if open failed, for proper error reporting.
Then mark it closed so we don't try to close it.
This commit is contained in:
@ -255,12 +255,13 @@ _mysql_connect(
|
|||||||
conn = mysql_real_connect(&(c->connection), host, user, passwd, db,
|
conn = mysql_real_connect(&(c->connection), host, user, passwd, db,
|
||||||
port, unix_socket, client_flag);
|
port, unix_socket, client_flag);
|
||||||
Py_END_ALLOW_THREADS ;
|
Py_END_ALLOW_THREADS ;
|
||||||
|
c->open = 1;
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
_mysql_Exception(c);
|
_mysql_Exception(c);
|
||||||
|
c->open = 0;
|
||||||
Py_DECREF(c);
|
Py_DECREF(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
c->open = 1;
|
|
||||||
return (PyObject *) c;
|
return (PyObject *) c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user