summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-10 14:06:08 (GMT)
committerGitHub <noreply@github.com>2018-12-10 14:06:08 (GMT)
commitfc662ac332443a316a120fa5287c235dc4f8739b (patch)
tree3283170105c2e3b2dafa7233f4819cabab9fbb8d /Modules/_sqlite/connection.c
parentdffccc6b594951fc798973e521da205785823f0f (diff)
downloadcpython-fc662ac332443a316a120fa5287c235dc4f8739b.zip
cpython-fc662ac332443a316a120fa5287c235dc4f8739b.tar.gz
cpython-fc662ac332443a316a120fa5287c235dc4f8739b.tar.bz2
bpo-32788: Better error handling in sqlite3. (GH-3723)
Propagate unexpected errors (like MemoryError and KeyboardInterrupt) to user.
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index fe0d03b..aab4b1a 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1432,6 +1432,7 @@ finally:
static PyObject *
pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
{
+ _Py_IDENTIFIER(_iterdump);
PyObject* retval = NULL;
PyObject* module = NULL;
PyObject* module_dict;
@@ -1451,9 +1452,12 @@ pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- pyfn_iterdump = PyDict_GetItemString(module_dict, "_iterdump");
+ pyfn_iterdump = _PyDict_GetItemIdWithError(module_dict, &PyId__iterdump);
if (!pyfn_iterdump) {
- PyErr_SetString(pysqlite_OperationalError, "Failed to obtain _iterdump() reference");
+ if (!PyErr_Occurred()) {
+ PyErr_SetString(pysqlite_OperationalError,
+ "Failed to obtain _iterdump() reference");
+ }
goto finally;
}