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 /Modules/_sqlite/connection.c | |
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 'Modules/_sqlite/connection.c')
-rw-r--r-- | Modules/_sqlite/connection.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 7a8a5a1b..0ed196d 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1215,7 +1215,8 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py if (rc == PYSQLITE_TOO_MUCH_SQL) { PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time."); } else if (rc == PYSQLITE_SQL_WRONG_TYPE) { - PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string or unicode."); + if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string or unicode."); } else { (void)pysqlite_statement_reset(statement); _pysqlite_seterror(self->db, NULL); |