[issue28729] Exception from sqlite3 adapter masked by sqlite3.InterfaceError

Julien Palard report at bugs.python.org
Thu Nov 17 19:02:49 EST 2016


Julien Palard added the comment:

Problems looks from `Modules/_sqlite/statement.c`:

```
if (!_need_adapt(current_param)) {
    adapted = current_param;
} else {
    adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, NULL);
    if (adapted) {
        Py_DECREF(current_param);
    } else {
        PyErr_Clear();
        adapted = current_param;
    }
}
```

It has not changed since 2006, since e200ab5b3e (backport from pysqlite2 SVN repository).

I read it as "If an parameter needs an adapter, and the adapter fails, that's OK, continue with the original (unadapted) parameter.", which looks wrong to me, but I may miss something obvious? I tried to set an error instead of restoring the `current_param` and the 261 tests went well, but I'm not yet aware of the coverage of adapters in tests.

----------
nosy: +mdk

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28729>
_______________________________________


More information about the Python-bugs-list mailing list