mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
b25d09a15e
commit
b45b7b2137
3 changed files with 90 additions and 61 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue