Skip to content

Commit 98bec5f

Browse files
committed
fixup
1 parent b079374 commit 98bec5f

File tree

5 files changed

+238
-237
lines changed

5 files changed

+238
-237
lines changed

MySQLdb/cursors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _warning_check(self):
111111
if self._warnings:
112112
# When there is next result, fetching warnings cause "command
113113
# out of sync" error.
114-
if self._result.has_next:
114+
if self._result and self._result.has_next:
115115
msg = "There are %d MySQL warnings." % (self._warnings,)
116116
self.messages.append(msg)
117117
warn(msg, self.Warning, 3)

_mysql.c

+28-28
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static PyObject *_mysql_IntegrityError;
6868
static PyObject *_mysql_InternalError;
6969
static PyObject *_mysql_ProgrammingError;
7070
static PyObject *_mysql_NotSupportedError;
71-
71+
7272
typedef struct {
7373
PyObject_HEAD
7474
MYSQL connection;
@@ -227,7 +227,7 @@ _mysql_Exception(_mysql_ConnectionObject *c)
227227
Py_DECREF(t);
228228
return NULL;
229229
}
230-
230+
231231
static char _mysql_server_init__doc__[] =
232232
"Initialize embedded server. If this client is not linked against\n\
233233
the embedded server library, this function does nothing.\n\
@@ -250,7 +250,7 @@ static PyObject *_mysql_server_init(
250250
"already initialized");
251251
return NULL;
252252
}
253-
253+
254254
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO", kwlist,
255255
&cmd_args, &groups))
256256
return NULL;
@@ -349,7 +349,7 @@ static PyObject *_mysql_server_end(
349349
}
350350
return _mysql_Exception(NULL);
351351
}
352-
352+
353353
#if MYSQL_VERSION_ID >= 32314
354354
static char _mysql_thread_safe__doc__[] =
355355
"Indicates whether the client is compiled as thread-safe.";
@@ -557,7 +557,7 @@ _mysql_ConnectionObject_Initialize(
557557
char *init_command=NULL,
558558
*read_default_file=NULL,
559559
*read_default_group=NULL;
560-
560+
561561
self->converter = NULL;
562562
self->open = 0;
563563
check_server_init(-1);
@@ -741,7 +741,7 @@ _mysql_connect(
741741
PyObject *kwargs)
742742
{
743743
_mysql_ConnectionObject *c=NULL;
744-
744+
745745
c = MyAlloc(_mysql_ConnectionObject, _mysql_ConnectionObject_Type);
746746
if (c == NULL) return NULL;
747747
if (_mysql_ConnectionObject_Initialize(c, args, kwargs)) {
@@ -1291,7 +1291,7 @@ _mysql_escape_dict(
12911291
Py_XDECREF(r);
12921292
return NULL;
12931293
}
1294-
1294+
12951295
static char _mysql_ResultObject_describe__doc__[] =
12961296
"Returns the sequence of 7-tuples required by the DB-API for\n\
12971297
the Cursor.description attribute.\n\
@@ -1328,7 +1328,7 @@ _mysql_ResultObject_describe(
13281328
Py_XDECREF(d);
13291329
return NULL;
13301330
}
1331-
1331+
13321332
static char _mysql_ResultObject_field_flags__doc__[] =
13331333
"Returns a tuple of field flags, one for each column in the result.\n\
13341334
" ;
@@ -1736,7 +1736,7 @@ _mysql_ConnectionObject_get_character_set_info(
17361736
{
17371737
PyObject *result;
17381738
MY_CHARSET_INFO cs;
1739-
1739+
17401740
if (!PyArg_ParseTuple(args, "")) return NULL;
17411741
check_connection(self);
17421742
mysql_get_character_set_info(&(self->connection), &cs);
@@ -2726,44 +2726,44 @@ PyTypeObject _mysql_ConnectionObject_Type = {
27262726
0, /* tp_setattr */
27272727
0, /*tp_compare*/
27282728
(reprfunc)_mysql_ConnectionObject_repr, /* tp_repr */
2729-
2729+
27302730
/* Method suites for standard classes */
2731-
2731+
27322732
0, /* (PyNumberMethods *) tp_as_number */
27332733
0, /* (PySequenceMethods *) tp_as_sequence */
27342734
0, /* (PyMappingMethods *) tp_as_mapping */
2735-
2735+
27362736
/* More standard operations (here for binary compatibility) */
2737-
2737+
27382738
0, /* (hashfunc) tp_hash */
27392739
0, /* (ternaryfunc) tp_call */
27402740
0, /* (reprfunc) tp_str */
27412741
(getattrofunc)_mysql_ConnectionObject_getattro, /* tp_getattro */
27422742
(setattrofunc)_mysql_ConnectionObject_setattro, /* tp_setattro */
2743-
2743+
27442744
/* Functions to access object as input/output buffer */
27452745
0, /* (PyBufferProcs *) tp_as_buffer */
2746-
2746+
27472747
/* (tp_flags) Flags to define presence of optional/expanded features */
27482748
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
27492749
_mysql_connect__doc__, /* (char *) tp_doc Documentation string */
27502750

27512751
/* call function for all accessible objects */
27522752
(traverseproc) _mysql_ConnectionObject_traverse, /* tp_traverse */
2753-
2753+
27542754
/* delete references to contained objects */
27552755
(inquiry) _mysql_ConnectionObject_clear, /* tp_clear */
27562756

27572757
/* rich comparisons */
27582758
0, /* (richcmpfunc) tp_richcompare */
2759-
2759+
27602760
/* weak reference enabler */
27612761
0, /* (long) tp_weaklistoffset */
27622762

27632763
/* Iterators */
27642764
0, /* (getiterfunc) tp_iter */
27652765
0, /* (iternextfunc) tp_iternext */
2766-
2766+
27672767
/* Attribute descriptor and subclassing stuff */
27682768
(struct PyMethodDef *)_mysql_ConnectionObject_methods, /* tp_methods */
27692769
(struct PyMemberDef *)_mysql_ConnectionObject_memberlist, /* tp_members */
@@ -2798,45 +2798,45 @@ PyTypeObject _mysql_ResultObject_Type = {
27982798
0, /* tp_setattr */
27992799
0, /*tp_compare*/
28002800
(reprfunc)_mysql_ResultObject_repr, /* tp_repr */
2801-
2801+
28022802
/* Method suites for standard classes */
2803-
2803+
28042804
0, /* (PyNumberMethods *) tp_as_number */
28052805
0, /* (PySequenceMethods *) tp_as_sequence */
28062806
0, /* (PyMappingMethods *) tp_as_mapping */
2807-
2807+
28082808
/* More standard operations (here for binary compatibility) */
2809-
2809+
28102810
0, /* (hashfunc) tp_hash */
28112811
0, /* (ternaryfunc) tp_call */
28122812
0, /* (reprfunc) tp_str */
28132813
(getattrofunc)PyObject_GenericGetAttr, /* tp_getattro */
28142814
(setattrofunc)_mysql_ResultObject_setattro, /* tp_setattr */
2815-
2815+
28162816
/* Functions to access object as input/output buffer */
28172817
0, /* (PyBufferProcs *) tp_as_buffer */
2818-
2818+
28192819
/* Flags to define presence of optional/expanded features */
28202820
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
2821-
2821+
28222822
_mysql_ResultObject__doc__, /* (char *) tp_doc Documentation string */
28232823

28242824
/* call function for all accessible objects */
28252825
(traverseproc) _mysql_ResultObject_traverse, /* tp_traverse */
2826-
2826+
28272827
/* delete references to contained objects */
28282828
(inquiry) _mysql_ResultObject_clear, /* tp_clear */
28292829

28302830
/* rich comparisons */
28312831
0, /* (richcmpfunc) tp_richcompare */
2832-
2832+
28332833
/* weak reference enabler */
28342834
0, /* (long) tp_weaklistoffset */
28352835

28362836
/* Iterators */
28372837
0, /* (getiterfunc) tp_iter */
28382838
0, /* (iternextfunc) tp_iternext */
2839-
2839+
28402840
/* Attribute descriptor and subclassing stuff */
28412841
(struct PyMethodDef *) _mysql_ResultObject_methods, /* tp_methods */
28422842
(struct PyMemberDef *) _mysql_ResultObject_memberlist, /*tp_members */

tests/configdb.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
read_default_group = "MySQLdb-tests",
1111
)
1212

13+
1314
def connection_kwargs(kwargs):
1415
db_kwargs = connect_kwargs.copy()
1516
db_kwargs.update(kwargs)
1617
return db_kwargs
1718

19+
1820
def connection_factory(**kwargs):
1921
import MySQLdb
2022
db_kwargs = connection_kwargs(kwargs)
2123
db = MySQLdb.connect(**db_kwargs)
2224
return db
23-
24-
25-

0 commit comments

Comments
 (0)