Skip to content

Commit fe7d0c3

Browse files
committed
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.
1 parent 5d538b6 commit fe7d0c3

3 files changed

Lines changed: 2 additions & 12 deletions

File tree

Lib/sqlite3/test/hooks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ def CheckCreateCollationNotAscii(self):
4848
pass
4949

5050
def CheckCollationIsUsed(self):
51-
if sqlite.version_info < (3, 2, 1): # old SQLite versions crash on this test
52-
return
5351
def mycoll(x, y):
5452
# reverse order
5553
return -cmp(x, y)

Lib/sqlite3/test/userfunctions.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ def CheckFuncReturnBlob(self):
200200
self.failUnlessEqual(val, buffer("blob"))
201201

202202
def CheckFuncException(self):
203-
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
204-
return
205203
cur = self.con.cursor()
206204
try:
207205
cur.execute("select raiseexception()")
@@ -285,8 +283,6 @@ def CheckAggrNoStep(self):
285283
self.failUnlessEqual(e.args[0], "AggrNoStep instance has no attribute 'step'")
286284

287285
def CheckAggrNoFinalize(self):
288-
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
289-
return
290286
cur = self.con.cursor()
291287
try:
292288
cur.execute("select nofinalize(t) from test")
@@ -296,8 +292,6 @@ def CheckAggrNoFinalize(self):
296292
self.failUnlessEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error")
297293

298294
def CheckAggrExceptionInInit(self):
299-
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
300-
return
301295
cur = self.con.cursor()
302296
try:
303297
cur.execute("select excInit(t) from test")
@@ -307,8 +301,6 @@ def CheckAggrExceptionInInit(self):
307301
self.failUnlessEqual(e.args[0], "user-defined aggregate's '__init__' method raised error")
308302

309303
def CheckAggrExceptionInStep(self):
310-
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
311-
return
312304
cur = self.con.cursor()
313305
try:
314306
cur.execute("select excStep(t) from test")
@@ -318,8 +310,6 @@ def CheckAggrExceptionInStep(self):
318310
self.failUnlessEqual(e.args[0], "user-defined aggregate's 'step' method raised error")
319311

320312
def CheckAggrExceptionInFinalize(self):
321-
if sqlite.version_info < (3, 3, 3): # don't raise bug in earlier SQLite versions
322-
return
323313
cur = self.con.cursor()
324314
try:
325315
cur.execute("select excFinalize(t) from test")

Modules/_sqlite/connection.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len)
4242
* segfaults, depending on the SQLite version */
4343
#if SQLITE_VERSION_NUMBER >= 3003003
4444
sqlite3_result_error(ctx, errmsg, len);
45+
#else
46+
PyErr_SetString(OperationalError, errmsg);
4547
#endif
4648
}
4749

0 commit comments

Comments
 (0)