Gerhard Häring wrote:
Co-posting to python-dev in the hope of getting help of people verifying
my suspicion ...
Gerhard Häring wrote:
[...]
For some reason, they don't seem to have picked up the changed tests of
the sqlite3 module. At least the error messages look exactly like the
ones I had when I ran the current code against old tests.
That guess was wrong. The failed sqlite3 tests come from an old SQLite
version being linked against. Until recently, SQLite was buggy and it
was only fixed in
http://www.sqlite.org/cvstrac/chngview?cn=2981
that callbacks can throw errors that are usefully returned to the
original caller.
The tests for the sqlite3 module currently assume a recent version
SQLite (3.3.something). Otherwise some tests will fail.
Still, it can be built against any SQLite 3 release.
Can somebody please also verify if the malloc/free error message goes
away (it really only happened on Mac, didn't it?) if you upgrade SQLite
to the latest version on the build host?
With SQLite 3.2.8, I also get segfaults on Linux x86 (Ubuntu dapper, gcc).
I've provided a preliminary patch (cannot check in from this place) that
I've attached. Maybe somebody wants to test it, otherwise I'll make a
few other tests in the late evening and probably also selectively
disable certain tests in the test suite if the SQLite version is too old
to pass them.
-- Gerhard
Index: Modules/_sqlite/connection.c
===================================================================
--- Modules/_sqlite/connection.c (revision 46958)
+++ Modules/_sqlite/connection.c (working copy)
@@ -34,6 +34,16 @@
static int connection_set_isolation_level(Connection* self, PyObject*
isolation_level);
+
+void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len)
+{
+#if SQLITE_VERSION_NUMBER >= 3003003
+ sqlite3_result_error(ctx, errmsg, len);
+#else
+ /* sqlite3_result_null(ctx); */
+#endif
+}
+
int connection_init(Connection* self, PyObject* args, PyObject* kwargs)
{
static char *kwlist[] = {"database", "timeout", "detect_types",
"isolation_level", "check_same_thread", "factory", "cached_statements", NULL,
NULL};
@@ -526,7 +536,7 @@
} else {
PyErr_Clear();
}
- sqlite3_result_error(context, "user-defined function raised
exception", -1);
+ _sqlite3_result_error(context, "user-defined function raised
exception", -1);
}
PyGILState_Release(threadstate);
@@ -558,7 +568,7 @@
} else {
PyErr_Clear();
}
- sqlite3_result_error(context, "user-defined aggregate's '__init__'
method raised error", -1);
+ _sqlite3_result_error(context, "user-defined aggregate's
'__init__' method raised error", -1);
goto error;
}
}
@@ -582,7 +592,7 @@
} else {
PyErr_Clear();
}
- sqlite3_result_error(context, "user-defined aggregate's 'step' method
raised error", -1);
+ _sqlite3_result_error(context, "user-defined aggregate's 'step' method
raised error", -1);
}
error:
@@ -619,7 +629,7 @@
} else {
PyErr_Clear();
}
- sqlite3_result_error(context, "user-defined aggregate's 'finalize'
method raised error", -1);
+ _sqlite3_result_error(context, "user-defined aggregate's 'finalize'
method raised error", -1);
} else {
_set_result(context, function_result);
}
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com