diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-13 03:28:34 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-13 03:28:34 (GMT) |
commit | 0201f443f6ec06c468b044d5c2426df520e73dfa (patch) | |
tree | 09f7d157484cef00f4ff23d2717bec3d96bcaf30 /Lib | |
parent | 5e0110e0c8e5cd5fc6d9571c2def0e6956767107 (diff) | |
download | cpython-0201f443f6ec06c468b044d5c2426df520e73dfa.zip cpython-0201f443f6ec06c468b044d5c2426df520e73dfa.tar.gz cpython-0201f443f6ec06c468b044d5c2426df520e73dfa.tar.bz2 |
Merged revisions 78898 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78898 | victor.stinner | 2010-03-13 04:27:07 +0100 (sam., 13 mars 2010) | 7 lines
sqlite3: Fix a segfault on calling a connection with something else than a
string. Initialize all attributes to be able to call the statement destructor
on error.
Avoid also a duplicate connection in some tests: setUp() does already open a
connection (":memory:").
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sqlite3/test/regression.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py index 7ed0d92..255bd3f 100644 --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -242,8 +242,7 @@ class RegressionTests(unittest.TestCase): Verifies that running a PRAGMA statement that does an autocommit does work. This did not work in 2.5.3/2.5.4. """ - con = sqlite.connect(":memory:") - cur = con.cursor() + cur = self.con.cursor() cur.execute("create table foo(bar)") cur.execute("insert into foo(bar) values (5)") @@ -263,11 +262,17 @@ class RegressionTests(unittest.TestCase): def __hash__(self): raise TypeError() var = NotHashable() - con = sqlite.connect(":memory:") - self.assertRaises(TypeError, con.create_function, var) - self.assertRaises(TypeError, con.create_aggregate, var) - self.assertRaises(TypeError, con.set_authorizer, var) - self.assertRaises(TypeError, con.set_progress_handler, var) + self.assertRaises(TypeError, self.con.create_function, var) + self.assertRaises(TypeError, self.con.create_aggregate, var) + self.assertRaises(TypeError, self.con.set_authorizer, var) + self.assertRaises(TypeError, self.con.set_progress_handler, var) + + def CheckConnectionCall(self): + """ + Call a connection with a non-string SQL request: check error handling + of the statement constructor. + """ + self.assertRaises(sqlite.Warning, self.con, 1) def suite(): regression_suite = unittest.makeSuite(RegressionTests, "Check") |