summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/odictobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index a03e995..d6189a3 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1789,6 +1789,8 @@ odictiter_nextkey(odictiterobject *di)
/* Get the key. */
node = _odict_find_node(di->di_odict, di->di_current);
if (node == NULL) {
+ if (!PyErr_Occurred())
+ PyErr_SetObject(PyExc_KeyError, di->di_current);
/* Must have been deleted. */
Py_CLEAR(di->di_current);
return NULL;