diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:29:05 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-11 10:29:05 (GMT) |
commit | 42d67af87fc2b1d297cce1cd8d762461e009f0a0 (patch) | |
tree | e9ad2265f9dc6bd1f5aee05f8bc64b0d45a4d3fd /Lib/sqlite3 | |
parent | abf68ce16474a2d252723099f1c7a6d640191123 (diff) | |
download | cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.zip cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.tar.gz cpython-42d67af87fc2b1d297cce1cd8d762461e009f0a0.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/sqlite3')
-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 c557ab6..eaaaa2c 100644 --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -336,6 +336,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,)) |