1227 static PyObject *
1228 _mysql_escape_sequence(
1229 PyObject *self,
1230 PyObject *args)
1231 {
1232 PyObject *o=NULL, *d=NULL, *r=NULL, *item, *quoted;
1233 int i, n;
1234 if (!PyArg_ParseTuple(args, "OO:escape_sequence", &o, &d))
when PyArg_ParseTuple() succeeds
taking False path
1235 goto error;
1236 if (!PyMapping_Check(d)) {
when considering range: -0x80000000 <= value <= -1
taking False path
1237 PyErr_SetString(PyExc_TypeError,
1238 "argument 2 must be a mapping");
1239 return NULL;
1240 }
1241 if ((n = PyObject_Length(o)) == -1) goto error;
when considering value == (int)-1 from _mysql.c:1241
taking True path
1242 if (!(r = PyTuple_New(n))) goto error;
1243 for (i=0; i<n; i++) {
1244 item = PySequence_GetItem(o, i);
1245 if (!item) goto error;
1246 quoted = _escape_item(item, d);
1247 Py_DECREF(item);
1248 if (!quoted) goto error;
1249 PyTuple_SET_ITEM(r, i, quoted);
1250 }
1251 return r;
1252 error:
1253 Py_XDECREF(r);
taking True path
1254 return NULL;
1255 }