Commit c741f885 authored by Neal Norwitz's avatar Neal Norwitz

Speculative checkin (requires approval of Gerhard Haering)

This backs out the test changes in 46962 which prevented crashes
by not running the tests via a version check.  All the version checks
added in that rev were removed from the tests.

Code was added to the error handler in connection.c that seems
to work with older versions of sqlite including 3.1.3.
parent 487cb65a
...@@ -48,8 +48,6 @@ class CollationTests(unittest.TestCase): ...@@ -48,8 +48,6 @@ class CollationTests(unittest.TestCase):
pass pass
def CheckCollationIsUsed(self): def CheckCollationIsUsed(self):
if sqlite.version_info < (3, 2, 1): # old SQLite versions crash on this test
return
def mycoll(x, y): def mycoll(x, y):
# reverse order # reverse order
return -cmp(x, y) return -cmp(x, y)
......
...@@ -200,8 +200,6 @@ class FunctionTests(unittest.TestCase): ...@@ -200,8 +200,6 @@ class FunctionTests(unittest.TestCase):
self.failUnlessEqual(val, buffer("blob")) self.failUnlessEqual(val, buffer("blob"))
def CheckFuncException(self): def CheckFuncException(self):
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
return
cur = self.con.cursor() cur = self.con.cursor()
try: try:
cur.execute("select raiseexception()") cur.execute("select raiseexception()")
...@@ -285,8 +283,6 @@ class AggregateTests(unittest.TestCase): ...@@ -285,8 +283,6 @@ class AggregateTests(unittest.TestCase):
self.failUnlessEqual(e.args[0], "AggrNoStep instance has no attribute 'step'") self.failUnlessEqual(e.args[0], "AggrNoStep instance has no attribute 'step'")
def CheckAggrNoFinalize(self): def CheckAggrNoFinalize(self):
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
return
cur = self.con.cursor() cur = self.con.cursor()
try: try:
cur.execute("select nofinalize(t) from test") cur.execute("select nofinalize(t) from test")
...@@ -296,8 +292,6 @@ class AggregateTests(unittest.TestCase): ...@@ -296,8 +292,6 @@ class AggregateTests(unittest.TestCase):
self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error")
def CheckAggrExceptionInInit(self): def CheckAggrExceptionInInit(self):
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
return
cur = self.con.cursor() cur = self.con.cursor()
try: try:
cur.execute("select excInit(t) from test") cur.execute("select excInit(t) from test")
...@@ -307,8 +301,6 @@ class AggregateTests(unittest.TestCase): ...@@ -307,8 +301,6 @@ class AggregateTests(unittest.TestCase):
self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error")
def CheckAggrExceptionInStep(self): def CheckAggrExceptionInStep(self):
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
return
cur = self.con.cursor() cur = self.con.cursor()
try: try:
cur.execute("select excStep(t) from test") cur.execute("select excStep(t) from test")
...@@ -318,8 +310,6 @@ class AggregateTests(unittest.TestCase): ...@@ -318,8 +310,6 @@ class AggregateTests(unittest.TestCase):
self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error") self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error")
def CheckAggrExceptionInFinalize(self): def CheckAggrExceptionInFinalize(self):
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
return
cur = self.con.cursor() cur = self.con.cursor()
try: try:
cur.execute("select excFinalize(t) from test") cur.execute("select excFinalize(t) from test")
......
...@@ -42,6 +42,8 @@ void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len) ...@@ -42,6 +42,8 @@ void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len)
* segfaults, depending on the SQLite version */ * segfaults, depending on the SQLite version */
#if SQLITE_VERSION_NUMBER >= 3003003 #if SQLITE_VERSION_NUMBER >= 3003003
sqlite3_result_error(ctx, errmsg, len); sqlite3_result_error(ctx, errmsg, len);
#else
PyErr_SetString(OperationalError, errmsg);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment