[Python-checkins] r85968 - in python/branches/release31-maint: Misc/NEWS Objects/dictobject.c

raymond.hettinger python-checkins at python.org
Sat Oct 30 10:14:54 CEST 2010


Author: raymond.hettinger
Date: Sat Oct 30 10:14:53 2010
New Revision: 85968
Log:
Issue 10221: Improve error message for dict.pop().
Modified:
 python/branches/release31-maint/Misc/NEWS
 python/branches/release31-maint/Objects/dictobject.c
Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Sat Oct 30 10:14:53 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/release31-maint/Objects/dictobject.c
==============================================================================
--- python/branches/release31-maint/Objects/dictobject.c	(original)
+++ python/branches/release31-maint/Objects/dictobject.c	Sat Oct 30 10:14:53 2010
@@ -1810,8 +1810,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

AltStyle によって変換されたページ (->オリジナル) /