[DB-SIG] Patch for MySQLdb-0.0.3
Andy Dustman
adustman@comstar.net
Mon, 2 Aug 1999 00:25:55 -0400 (EDT)
I don't have time to put 0.0.4 together for a while, but this will
probably be the only change. This fixes a bug introduced in 0.0.3 where if
an exception is raised during the connect(), it dumps core.
Index: _mysqlmodule.c
===================================================================
RCS file: /usr1/cvsroot/python/mysql/_mysqlmodule.c,v
retrieving revision 1.13
diff -u -r1.13 _mysqlmodule.c
--- _mysqlmodule.c 1999/07/20 04:04:20 1.13
+++ _mysqlmodule.c 1999/08/02 04:15:13
@@ -399,6 +399,15 @@
&port, &unix_socket, &client_flag,
&conv))
return NULL;
+ if (conv) {
+ c->converter = conv;
+ Py_INCREF(conv);
+ } else {
+ if (!(c->converter = PyDict_New())) {
+ Py_DECREF(c);
+ return NULL;
+ }
+ }
Py_BEGIN_ALLOW_THREADS ;
conn = mysql_init(&(c->connection));
conn = mysql_real_connect(&(c->connection), host, user, passwd, db,
@@ -410,15 +419,6 @@
return NULL;
}
c->open = 1;
- if (conv) {
- c->converter = conv;
- Py_INCREF(conv);
- } else {
- if (!(c->converter = PyDict_New())) {
- Py_DECREF(c);
- return NULL;
- }
- }
return (PyObject *) c;
}
--
andy dustman | programmer/analyst | comstar communications corporation
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d