mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +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
|
|
@ -384,12 +384,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
|
|||
|
||||
if (multiple) {
|
||||
/* executemany() */
|
||||
if (!PyArg_ParseTuple(args, "OO", &operation, &second_argument)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!PyUnicode_Check(operation)) {
|
||||
PyErr_SetString(PyExc_ValueError, "operation parameter must be str");
|
||||
if (!PyArg_ParseTuple(args, "UO", &operation, &second_argument)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -406,12 +401,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
|
|||
}
|
||||
} else {
|
||||
/* execute() */
|
||||
if (!PyArg_ParseTuple(args, "O|O", &operation, &second_argument)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!PyUnicode_Check(operation)) {
|
||||
PyErr_SetString(PyExc_ValueError, "operation parameter must be str");
|
||||
if (!PyArg_ParseTuple(args, "U|O", &operation, &second_argument)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue