Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Unified Diff: Modules/_sqlite/row.c

Issue 13583: sqlite3.Row doesn't support slice indexes
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/sqlite3/test/factory.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_sqlite/row.c Sat Dec 10 12:31:42 2011 -0500
+++ b/Modules/_sqlite/row.c Sun Dec 11 22:42:19 2011 +0100
@@ -125,8 +125,13 @@
PyErr_SetString(PyExc_IndexError, "No item with that key");
return NULL;
} else if (PySlice_Check(idx)) {
- PyErr_SetString(PyExc_ValueError, "slices not implemented, yet");
- return NULL;
+ Py_ssize_t start, stop, step, slicelength;
+ if (PySlice_GetIndicesEx((PySliceObject*)idx,
+ PyTuple_GET_SIZE(self->data),
+ &start, &stop, &step, &slicelength) < 0) {
+ return NULL;
+ }
+ return PyTuple_GetSlice(self->data, start, stop);
} else {
PyErr_SetString(PyExc_IndexError, "Index must be int or string");
return NULL;
« no previous file with comments | « Lib/sqlite3/test/factory.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+