[Python-checkins] r85967 - in python/branches/py3k: Misc/NEWS Objects/dictobject.c
raymond.hettinger
python-checkins at python.org
Sat Oct 30 10:10:29 CEST 2010
Author: raymond.hettinger
Date: Sat Oct 30 10:10:29 2010
New Revision: 85967
Log:
Issue 10221: Improve error message for dict.pop().
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Objects/dictobject.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat Oct 30 10:10:29 2010
@@ -10,6 +10,9 @@
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.
Modified: python/branches/py3k/Objects/dictobject.c
==============================================================================
--- python/branches/py3k/Objects/dictobject.c (original)
+++ python/branches/py3k/Objects/dictobject.c Sat Oct 30 10:10:29 2010
@@ -1820,8 +1820,7 @@
Py_INCREF(deflt);
return deflt;
}
- PyErr_SetString(PyExc_KeyError,
- "pop(): dictionary is empty");
+ set_key_error(key);
return NULL;
}
if (!PyUnicode_CheckExact(key) ||
More information about the Python-checkins
mailing list