diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:27:19 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:27:19 (GMT) |
commit | 0aa6562913cabefa050fb6f4ab7b1289cde45286 (patch) | |
tree | d5a22bfb7956d4e32dc23e014598642dd92111ea /Lib | |
parent | 17c01785ee12331fb8cf782ded90a5eaed0b88e1 (diff) | |
download | cpython-0aa6562913cabefa050fb6f4ab7b1289cde45286.zip cpython-0aa6562913cabefa050fb6f4ab7b1289cde45286.tar.gz cpython-0aa6562913cabefa050fb6f4ab7b1289cde45286.tar.bz2 |
Issue #21147: sqlite3 now raises an exception if the request contains a null
character instead of truncate it. Based on patch by Victor Stinner.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sqlite3/test/regression.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py index 5b7759c..72c9277 100644 --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -319,6 +319,16 @@ class RegressionTests(unittest.TestCase): sqlite.connect, ":memory:", isolation_level=123) + def CheckNullCharacter(self): + # Issue #21147 + con = sqlite.connect(":memory:") + self.assertRaises(ValueError, con, "\0select 1") + self.assertRaises(ValueError, con, "select 1\0") + cur = con.cursor() + self.assertRaises(ValueError, cur.execute, " \0select 2") + self.assertRaises(ValueError, cur.execute, "select 2\0") + + def suite(): regression_suite = unittest.makeSuite(RegressionTests, "Check") return unittest.TestSuite((regression_suite,)) |