[pysqlite] sqlite3 - implicit close() when cursor object reclaimed?
Skip Montanaro <[email protected]> Sat, 6 Sep 2008 13:25:57 +0000 (UTC)
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Given this method:
def iterkeys(self):
c = self._conn.cursor()
c.execute("select key from dict order by key")
return (e[0] for e in c)
where self._conn is a sqlite3 connection (I'm using the code in Python 3.0b3
at the moment), is the cursor properly closed when the returned genexp is
freed? I saw no mention of Cursor.close in the Python 2.6 sqlite3 docs. In
the _sqlite/cursor.c file I see that at least part of what
pysqlite_cursor_close does is executed in pysqlite_cursor_dealloc, but not
everything. Shouldn't pysqlite_cursor_close be called from
pysqlite_cursor_dealloc?
Thx,
Skip Montanaro