summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/sqlite3/test/regression.py7
-rw-r--r--Modules/_sqlite/connection.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
index 2e61acf..da44551 100644
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -176,6 +176,13 @@ class RegressionTests(unittest.TestCase):
class MyStr(str): pass
self.con.execute("select ?", (MyStr("abc"),))
+ 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")
return unittest.TestSuite((regression_suite,))
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 08588bc..4b8088d 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -979,6 +979,12 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
return NULL;
}
+ statement->db = NULL;
+ statement->st = NULL;
+ statement->sql = NULL;
+ statement->in_use = 0;
+ statement->in_weakreflist = NULL;
+
rc = pysqlite_statement_create(statement, self, sql);
if (rc != SQLITE_OK) {