Torsten Landschoff <t.landsch...@gmx.net> added the comment: > 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)
The motivation for the 2.7er patch is mostly that we are still using Python 2.x at work and I made this patch for 2.7 first. Actually I will need to backport it to 2.6 but I guess there are no differences. And maybe I should have submitted this against pysqlite directly which is (AFAICT) also still targetting 2.x. > - you need to document the new API in Doc/library/sqlite3.rst Sure. I was just filing the report to have the code on file and this was only fallout from another patch. I will create an updated patch including documentation about the feature. > About the patch: looks mostly good! Thanks. > + 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)`? Fine with me. I did not know that "bar" in "foobarbaz" works (I was expecting it to act as if the right hand string is a list of characters). Obviously I was wrong. Further I thought "any" was new in 2.6 and therefore not suitable for use in pysqlite which was also wrong. > (`y in x` is simper and more readable than `x.find(y) != -1`) I agree, I just did not know it works for substrings. > + 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? Good catch. If SetItem fails, trace_callback may become invalid and the _trace_callback will crash. I did not think about that as I only derived that function from similar code in the module. I will have to fix this as well. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11688> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com