Commit 7529afce authored by Raymond Hettinger's avatar Raymond Hettinger

Issue 10221: Improve error message for dict.pop().

parent 6acd4324
......@@ -10,6 +10,9 @@ What's New in Python 3.1.3?
Core and Builtins
-----------------
- Issue #10221: dict.pop(k) now has a key error message that includes the
missing key (same message d[k] returns for missing keys).
- Issue #5437: A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
......
......@@ -1810,8 +1810,7 @@ dict_pop(PyDictObject *mp, PyObject *args)
Py_INCREF(deflt);
return deflt;
}
PyErr_SetString(PyExc_KeyError,
"pop(): dictionary is empty");
set_key_error(key);
return NULL;
}
if (!PyUnicode_CheckExact(key) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment