[Python-checkins] cpython: Issue #18520: Fix _PyDict_GetItemId(), suppress _PyUnicode_FromId() error

victor.stinner python-checkins at python.org
Mon Jul 22 23:59:14 CEST 2013


http://hg.python.org/cpython/rev/4a69dbe71aeb
changeset:   84799:4a69dbe71aeb
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 22 23:50:57 2013 +0200
summary:
  Issue #18520: Fix _PyDict_GetItemId(), suppress _PyUnicode_FromId() error

As PyDict_GetItem(), _PyDict_GetItemId() suppresses all errors that may occur,
for historical reasons.

files:
  Objects/dictobject.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Objects/dictobject.c b/Objects/dictobject.c
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2684,8 +2684,10 @@
 {
     PyObject *kv;
     kv = _PyUnicode_FromId(key); /* borrowed */
-    if (kv == NULL)
+    if (kv == NULL) {
+        PyErr_Clear();
         return NULL;
+    }
     return PyDict_GetItem(dp, kv);
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list