summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/dbapi.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-02-01 20:18:19 (GMT)
committerPetri Lehtinen <petri@digip.org>2012-02-01 20:18:35 (GMT)
commit023fe334bbb61fd4912dd6f3e02e19528333ac62 (patch)
treebcc9603314261713798c504f4043920c738926a4 /Lib/sqlite3/test/dbapi.py
parentfc3ba6b8fc0d9212cbae676a5c84847245767464 (diff)
downloadcpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.zip
cpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.tar.gz
cpython-023fe334bbb61fd4912dd6f3e02e19528333ac62.tar.bz2
sqlite3: Handle strings with embedded zeros correctly
Closes #13676.
Diffstat (limited to 'Lib/sqlite3/test/dbapi.py')
-rw-r--r--Lib/sqlite3/test/dbapi.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 518b8ae..202bd38 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -225,6 +225,13 @@ class CursorTests(unittest.TestCase):
def CheckExecuteArgString(self):
self.cu.execute("insert into test(name) values (?)", ("Hugo",))
+ def CheckExecuteArgStringWithZeroByte(self):
+ self.cu.execute("insert into test(name) values (?)", ("Hu\x00go",))
+
+ self.cu.execute("select name from test where id=?", (self.cu.lastrowid,))
+ row = self.cu.fetchone()
+ self.assertEqual(row[0], "Hu\x00go")
+
def CheckExecuteWrongNoOfArgs1(self):
# too many parameters
try: