Issue 10221: Improve error message for dict.pop().
This commit is contained in:
parent
cbba8d4c7a
commit
2ad17e19ee
|
@ -10,6 +10,9 @@ What's New in Python 2.7.1?
|
|||
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 #10125: Don't segfault when the iterator passed to ``file.writelines()``
|
||||
closes the file.
|
||||
|
||||
|
|
|
@ -1980,8 +1980,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 (!PyString_CheckExact(key) ||
|
||||
|
|
Loading…
Reference in New Issue