[issue11688] SQLite trace callback
Antoine Pitrou
report at bugs.python.org
Sun Mar 27 16:31:54 CEST 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
Thanks for the patch.
A couple of comments:
- this is a new feature, so can only go in in 3.x: no need to post a 2.7 patch (unless this helps Gerhard for his standalone project)
- you need to document the new API in Doc/library/sqlite3.rst
About the patch: looks mostly good!
+ self.assertTrue([x for x in traced_statements if x.find("create table foo") != -1])
This looks a bit complicated, why not something like
`any("create table foo" in x for x in traced_statements)`?
(`y in x` is simper and more readable than `x.find(y) != -1`)
+ sqlite3_trace(self->db, _trace_callback, trace_callback);
+ if (PyDict_SetItem(self->function_pinboard, trace_callback, Py_None) == -1)
+ return NULL;
Shouldn't sqlite3_trace() be called only after PyDict_SetItem() succeeds?
----------
nosy: +pitrou
stage: -> patch review
versions: -Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11688>
_______________________________________
More information about the Python-bugs-list
mailing list