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

Delta Between Two Patch Sets: Modules/_sqlite/row.c

Issue 10203: sqlite3.Row doesn't support sequence protocol
Left Patch Set: Created 5 years, 3 months ago
Right Patch Set: Created 5 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/sqlite3/test/factory.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* row.c - an enhanced tuple for database rows 1 /* row.c - an enhanced tuple for database rows
2 * 2 *
3 * Copyright (C) 2005-2010 Gerhard Häring <gh@ghaering.de> 3 * Copyright (C) 2005-2010 Gerhard Häring <gh@ghaering.de>
4 * 4 *
5 * This file is part of pysqlite. 5 * This file is part of pysqlite.
6 * 6 *
7 * This software is provided 'as-is', without any express or implied 7 * This software is provided 'as-is', without any express or implied
8 * warranty. In no event will the authors be held liable for any damages 8 * warranty. In no event will the authors be held liable for any damages
9 * arising from the use of this software. 9 * arising from the use of this software.
10 * 10 *
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 char* compare_key; 79 char* compare_key;
80 80
81 char* p1; 81 char* p1;
82 char* p2; 82 char* p2;
83 83
84 PyObject* item; 84 PyObject* item;
85 85
86 if (PyLong_Check(idx)) { 86 if (PyLong_Check(idx)) {
87 _idx = PyLong_AsLongAndOverflow(idx, &long_overflow); 87 _idx = PyLong_AsLongAndOverflow(idx, &long_overflow);
88 if (long_overflow) { 88 if (long_overflow) {
89 PyErr_SetString(PyExc_OverflowError, 89 PyErr_Format(PyExc_IndexError,
90 "Row index doesn't fit into a long."); 90 "cannot fit '%.200s' into an index-sized integer",
91 idx->ob_type->tp_name);
91 return NULL; 92 return NULL;
92 } 93 }
93 if (_idx < 0) 94 if (_idx < 0)
94 _idx += PyTuple_GET_SIZE(self->data); 95 _idx += PyTuple_GET_SIZE(self->data);
95 item = PyTuple_GetItem(self->data, _idx); 96 item = PyTuple_GetItem(self->data, _idx);
96 Py_XINCREF(item); 97 Py_XINCREF(item);
97 return item; 98 return item;
98 } else if (PyUnicode_Check(idx)) { 99 } else if (PyUnicode_Check(idx)) {
99 key = _PyUnicode_AsString(idx); 100 key = _PyUnicode_AsString(idx);
100 if (key == NULL) 101 if (key == NULL)
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 0 /* tp_free */ 271 0 /* tp_free */
271 }; 272 };
272 273
273 extern int pysqlite_row_setup_types(void) 274 extern int pysqlite_row_setup_types(void)
274 { 275 {
275 pysqlite_RowType.tp_new = PyType_GenericNew; 276 pysqlite_RowType.tp_new = PyType_GenericNew;
276 pysqlite_RowType.tp_as_mapping = &pysqlite_row_as_mapping; 277 pysqlite_RowType.tp_as_mapping = &pysqlite_row_as_mapping;
277 pysqlite_RowType.tp_as_sequence = &pysqlite_row_as_sequence; 278 pysqlite_RowType.tp_as_sequence = &pysqlite_row_as_sequence;
278 return PyType_Ready(&pysqlite_RowType); 279 return PyType_Ready(&pysqlite_RowType);
279 } 280 }
LEFTRIGHT

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