This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pfalcon
Recipients pfalcon
Date 2010-10-26.19:11:30
SpamBayes Score 5.10086e-12
Marked as misclassified No
Message-id <>
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():

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:

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:34pfalconsetrecipients: + pfalcon
2010-10-26 19:11:33pfalconsetmessageid: <>
2010-10-26 19:11:31pfalconlinkissue10203 messages
2010-10-26 19:11:31pfalconcreate