mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37406: sqlite3 raises TypeError for wrong operation type (GH-14386)
The sqlite3 module now raises TypeError, rather than ValueError, if operation argument type is not str: execute(), executemany() and calling a connection.
This commit is contained in:
parent
ed076ed467
commit
c6a2320e87
6 changed files with 11 additions and 16 deletions
|
@ -59,6 +59,8 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
|
|||
self->st = NULL;
|
||||
self->in_use = 0;
|
||||
|
||||
assert(PyUnicode_Check(sql));
|
||||
|
||||
sql_cstr = PyUnicode_AsUTF8AndSize(sql, &sql_cstr_len);
|
||||
if (sql_cstr == NULL) {
|
||||
rc = PYSQLITE_SQL_WRONG_TYPE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue