Skip to content

Commit 1153287

Browse files
committed
Merge pull request #9 from PyMySQL/fix-warnings
Fix warnings while building _mysql.so
2 parents acf2c8c + e7e3a9b commit 1153287

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

_mysql.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ PERFORMANCE OF THIS SOFTWARE.
3030
#include "mysql.h"
3131
#include "mysqld_error.h"
3232

33+
#ifdef HAVE_WCSCOLL
34+
#undef HAVE_WCSCOLL
35+
#endif
36+
#ifdef SIZEOF_SIZE_T
37+
#undef SIZEOF_SIZE_T
38+
#endif
39+
3340
#include "Python.h"
3441
#if PY_MAJOR_VERSION >= 3
3542
#define IS_PY3K
@@ -1352,9 +1359,9 @@ _mysql_field_to_python(
13521359
unsigned long length,
13531360
MYSQL_FIELD *field)
13541361
{
1355-
int field_type = field->type;
13561362
PyObject *v;
13571363
#ifdef IS_PY3K
1364+
int field_type = field->type;
13581365
// Return bytes for binary and string types.
13591366
int binary = 0;
13601367
if (field_type == FIELD_TYPE_TINY_BLOB ||
@@ -1368,7 +1375,6 @@ _mysql_field_to_python(
13681375
#endif
13691376
if (rowitem) {
13701377
if (converter != Py_None) {
1371-
const char *fmt = "s#";
13721378
v = PyObject_CallFunction(converter,
13731379
#ifdef IS_PY3K
13741380
binary ? "y#" : "s#",
@@ -1569,7 +1575,7 @@ _mysql_ResultObject_fetch_row(
15691575
&maxrows, &how))
15701576
return NULL;
15711577
check_result_connection(self);
1572-
if (how < 0 || how >= sizeof(row_converters)) {
1578+
if (how >= sizeof(row_converters)) {
15731579
PyErr_SetString(PyExc_ValueError, "how out of range");
15741580
return NULL;
15751581
}
@@ -1974,7 +1980,6 @@ _mysql_ConnectionObject_query(
19741980
{
19751981
char *query;
19761982
int len, r;
1977-
MYSQL *mysql = &(self->connection);
19781983
if (!PyArg_ParseTuple(args, "s#:query", &query, &len)) return NULL;
19791984
check_connection(self);
19801985

@@ -2018,8 +2023,7 @@ static PyObject *
20182023
_mysql_ConnectionObject_read_query_result(
20192024
_mysql_ConnectionObject *self)
20202025
{
2021-
char *query;
2022-
int len, r;
2026+
int r;
20232027
MYSQL *mysql = &(self->connection);
20242028
check_connection(self);
20252029

@@ -2663,7 +2667,7 @@ _mysql_ConnectionObject_getattro(
26632667
if (strcmp(cname, "closed") == 0)
26642668
return PyInt_FromLong((long)!(self->open));
26652669

2666-
return PyObject_GenericGetAttr(self, name);
2670+
return PyObject_GenericGetAttr((PyObject *)self, name);
26672671
}
26682672

26692673
static int
@@ -2677,7 +2681,7 @@ _mysql_ConnectionObject_setattro(
26772681
"can't delete connection attributes");
26782682
return -1;
26792683
}
2680-
return PyObject_GenericSetAttr(self, name, v);
2684+
return PyObject_GenericSetAttr((PyObject *)self, name, v);
26812685
}
26822686

26832687
static int
@@ -2691,7 +2695,7 @@ _mysql_ResultObject_setattro(
26912695
"can't delete connection attributes");
26922696
return -1;
26932697
}
2694-
return PyObject_GenericSetAttr(self, name, v);
2698+
return PyObject_GenericSetAttr((PyObject *)self, name, v);
26952699
}
26962700

26972701
PyTypeObject _mysql_ConnectionObject_Type = {

0 commit comments

Comments
 (0)