summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-04 20:05:38 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-04 20:05:38 (GMT)
commitb45b7b213742261c95324766027d44e30656b8e7 (patch)
tree2cf155f3914de3220bdf478d4dc3250a2c9bbaaf /Objects
parentb25d09a15e58a5339d9720a9c99e48a3b144e1d7 (diff)
downloadcpython-b45b7b213742261c95324766027d44e30656b8e7.zip
cpython-b45b7b213742261c95324766027d44e30656b8e7.tar.gz
cpython-b45b7b213742261c95324766027d44e30656b8e7.tar.bz2
Issue #25449: Iterating OrderedDict with keys with unstable hash now raises
KeyError in C implementations as well as in Python implementation. Added tests for OrderedDict subclasses.
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;