mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
bpo-32788: Better error handling in sqlite3. (GH-3723)
Propagate unexpected errors (like MemoryError and KeyboardInterrupt) to user.
This commit is contained in:
parent
dffccc6b59
commit
fc662ac332
7 changed files with 154 additions and 122 deletions
|
|
@ -119,7 +119,7 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
|
|||
pysqlite_Node* ptr;
|
||||
PyObject* data;
|
||||
|
||||
node = (pysqlite_Node*)PyDict_GetItem(self->mapping, key);
|
||||
node = (pysqlite_Node*)PyDict_GetItemWithError(self->mapping, key);
|
||||
if (node) {
|
||||
/* an entry for this key already exists in the cache */
|
||||
|
||||
|
|
@ -157,7 +157,11 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
|
|||
}
|
||||
ptr->prev = node;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
/* There is no entry for this key in the cache, yet. We'll insert a new
|
||||
* entry in the cache, and make space if necessary by throwing the
|
||||
* least used item out of the cache. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue