Message119639
sqlite.Row class doesn't implement sequence protocol, which is rather unfortunate, because it is described and expected to work like a tuple, with extra mapping-like functionality.
Specific issue I hit:
Adding rows to PyGTK ListStore,
model = gtk.ListStore(*db.getSchema())
for r in listGen():
model.append(r)
I get:
TypeError: expecting a sequence
Looking at PyGTK sources, append() method uses PySequence Check() on the argument. Looking at Python 2.6.5 abstract.c:
int
PySequence_Check(PyObject *s)
{
if (s && PyInstance_Check(s))
return PyObject_HasAttrString(s, "__getitem__");
if (PyObject_IsInstance(s, (PyObject *)&PyDict_Type))
return 0;
return s != NULL && s->ob_type->tp_as_sequence &&
s->ob_type->tp_as_sequence->sq_item != NULL;
}
And sqlite3.Row doesn't set ob_type->tp_as_sequence as of Py 2.6.5 or 2.7. |
|
Date |
User |
Action |
Args |
2010-10-26 19:11:34 | pfalcon | set | recipients:
+ pfalcon |
2010-10-26 19:11:33 | pfalcon | set | messageid: <1288120293.93.0.799619941752.issue10203@psf.upfronthosting.co.za> |
2010-10-26 19:11:31 | pfalcon | link | issue10203 messages |
2010-10-26 19:11:31 | pfalcon | create | |
|