New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-44859: Raise more accurate exceptions in sqlite3
#27695
base: main
Are you sure you want to change the base?
Conversation
If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the sqlite3 module are not responsible of using the SQLite C API correctly.
@serhiy-storchaka would you mind reviewing this? |
Failure to do so, will result in an assertion failure / segfault.
@serhiy-storchaka PTAL. I just fixed bug in |
@malemburg would you mind taking a look at this PR? I'm slowly trying to align the exceptions raised with PEP 249. |
@@ -556,8 +556,6 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) | |||
} else if (PyObject_CheckBuffer(py_val)) { | |||
Py_buffer view; | |||
if (PyObject_GetBuffer(py_val, &view, PyBUF_SIMPLE) != 0) { | |||
PyErr_SetString(PyExc_ValueError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's no test for this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add one, thanks!
Improve exception compliancy with PEP 249
If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the
sqlite3 module are not responsible of using the SQLite C API correctly.
than one statement
_pysqlite_set_result
raises an exception if it returns -1https://bugs.python.org/issue44859
The text was updated successfully, but these errors were encountered: