[issue13583] sqlite3.Row doesn't support slice indexes
Roundup Robot added the comment: New changeset e47f520eb756 by Serhiy Storchaka in branch 'default': Issue #13583: sqlite3.Row now supports slice indexing. https://hg.python.org/cpython/rev/e47f520eb756 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: ghaering - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Serhiy Storchaka added the comment: The implementation can be much simpler, but in any case thank you for your patches Lucas and Jessica. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Serhiy Storchaka added the comment: Could you look at the patch Gerhard? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Serhiy Storchaka added the comment: Here is a patch with much simpler implementation. -- components: +Extension Modules Added file: http://bugs.python.org/file38379/sqlite3_row_slice.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Serhiy Storchaka added the comment: May be just use PyObject_GetItem(self-data, idx)? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
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 rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Jessica McKellar added the comment: I've also uploaded a short script that sets up an in-memory sqlite database that fetches Rows, for easy manual testing. -- Added file: http://bugs.python.org/file35071/sqlite3_slicing_demo.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Antoine Pitrou pit...@free.fr added the comment: Thanks for the patch. Two things: - there is a compilation warning using gcc: /home/antoine/cpython/default/Modules/_sqlite/row.c: In function ‘pysqlite_row_subscript’: /home/antoine/cpython/default/Modules/_sqlite/row.c:128:26: attention : passing argument 1 of ‘PySlice_GetIndicesEx’ from incompatible pointer type - you can use assertEqual to avoid defining the error message yourself -- nosy: +pitrou stage: - patch review versions: -Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +ghaering versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
New submission from Lucas Sinclair blastoc...@mac.com: When using the sqlite3.Row object as a row factory, one can access the resulting rows by index (such as row[1]) or by name (such as row['b']). However, the slice functionality is lost, as doing row[0:2] raises the error: slices not implemented, yet Here is a patch that fixes this, I implemented it and I added the corresponding unit test. -- files: sqlrowslice.patch keywords: patch messages: 149251 nosy: xapple priority: normal severity: normal status: open title: sqlite3.Row doesn't support slice indexes type: feature request versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file23919/sqlrowslice.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com