summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/row.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-18 00:27:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-18 00:27:30 (GMT)
commit83e30bf4bda30153bb2e5dc881fb540e7411deb1 (patch)
tree226264cef72762262fad48f9f72577fd24eb6759 /Modules/_sqlite/row.c
parent83ed42bfbf003bd7720e2893a4da18a300f48fa8 (diff)
downloadcpython-83e30bf4bda30153bb2e5dc881fb540e7411deb1.zip
cpython-83e30bf4bda30153bb2e5dc881fb540e7411deb1.tar.gz
cpython-83e30bf4bda30153bb2e5dc881fb540e7411deb1.tar.bz2
Fix a compiler warning on Windows 64-bit: _sqlite module
Diffstat (limited to 'Modules/_sqlite/row.c')
-rw-r--r--Modules/_sqlite/row.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c
index 14c148e..4a87a04 100644
--- a/Modules/_sqlite/row.c
+++ b/Modules/_sqlite/row.c
@@ -67,7 +67,7 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
{
long _idx;
char* key;
- int nitems, i;
+ Py_ssize_t nitems, i;
char* compare_key;
char* p1;
@@ -88,7 +88,10 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
nitems = PyTuple_Size(self->description);
for (i = 0; i < nitems; i++) {
- compare_key = _PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0));
+ PyObject *obj;
+ obj = PyTuple_GET_ITEM(self->description, i);
+ obj = PyTuple_GET_ITEM(obj, 0);
+ compare_key = _PyUnicode_AsString(obj);
if (!compare_key) {
return NULL;
}
@@ -120,10 +123,12 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
PyErr_SetString(PyExc_IndexError, "No item with that key");
return NULL;
- } else if (PySlice_Check(idx)) {
+ }
+ else if (PySlice_Check(idx)) {
PyErr_SetString(PyExc_ValueError, "slices not implemented, yet");
return NULL;
- } else {
+ }
+ else {
PyErr_SetString(PyExc_IndexError, "Index must be int or string");
return NULL;
}