[issue13583] sqlite3.Row doesn't support slice indexes
Jessica McKellar
report at bugs.python.org
Mon Apr 28 08:03:24 CEST 2014
Jessica McKellar added the comment:
Thanks for the ticket and patch, xapple!
I updated the patch to address the compiler warning and use assertEqual.
While testing, I noticed that slicing with steps wasn't supported, so I expanded the sqlite3.Row slicing code to support steps, and added some additional tests.
The slicing code in Modules/_sqlite/row.c:pysqlite_row_subscript is unfortunately pretty redundant with the slicing code in Objects/tupleobject.c. It'd be better to either be able to factor the code from both into a function (but I couldn't see how to do this without making it part of the public API), or have tuple, sqlite.Row, etc. implement a shared slicing interface. Perhaps we should defer that decision to a future ticket, though.
Note that even after this patch, sqlite.Row instances don't support negative indices.
* This patch passes `make patchcheck`.
* The full test suite passes with this patch.
* There are no build warnings related to the patch.
----------
keywords: +needs review
nosy: +jesstess
versions: +Python 3.5 -Python 3.3
Added file: http://bugs.python.org/file35070/issue13583.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13583>
_______________________________________
More information about the Python-bugs-list
mailing list