#328 typo in _msql.c

MySQLdb-1.2
open
nobody
None
1
4 days ago
2012-11-28
Dominik Neise
No

Hi,

in Version MySQL-python-1.2.4b4 there seems to be a minor typo in _mysql.c which prevents from building correctly.
GCC will complain about:
_mysql.c:602: error: expected expression before ‘)’ token
error: command 'gcc' failed with exit status 1

(I apologize for the ugliness, but neither formatting the stuff below as code nor as preformated text, really gave a nice solution. However I hope one gets the point )

the code around line 602 is this:
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
#ifdef HAVE_MYSQL_OPT_READ_TIMEOUT
"|ssssisOiiisssiOii:connect",
#else
"|ssssisOiiisssiOi:connect",
#endif
kwlist,
&host, &user, &passwd, &db,
&port, &unix_socket, &conv,
&connect_timeout,
&compress, &named_pipe,
&init_command, &read_default_file,
&read_default_group,
&client_flag, &ssl,
&local_infile,
#ifdef HAVE_MYSQL_OPT_READ_TIMEOUT
&read_timeout
#endif
))
return -1;

and obviously, when HAVE_MYSQL_OPT_READ_TIMEOUT is not defined, there will be a trailing comma after &local_infile, inside the braces.
So it should rather be:
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
#ifdef HAVE_MYSQL_OPT_READ_TIMEOUT
"|ssssisOiiisssiOii:connect",
#else
"|ssssisOiiisssiOi:connect",
#endif
kwlist,
&host, &user, &passwd, &db,
&port, &unix_socket, &conv,
&connect_timeout,
&compress, &named_pipe,
&init_command, &read_default_file,
&read_default_group,
&client_flag, &ssl,
&local_infile
#ifdef HAVE_MYSQL_OPT_READ_TIMEOUT
, &read_timeout
#endif
))
return -1;

I apologize, if this bug is already solved in the svn. I am not really a developer and not familiar with all this stuff here. I just was not able to build the tar-ball and thought, maybe there are other users out there, having the same prob. So sorry in case of doubling tickets here....

Discussion