From fdcbab96024e1607a84e3ed746e2af052ca46c11 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 16 Jul 2013 22:16:05 +0200 Subject: [PATCH] Issue #18408: Fix PyDict_GetItemString(), suppress PyUnicode_FromString() error As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may occur for historical reasons. --- Objects/dictobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 9d8696a89e6..99247d39a3a 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2692,8 +2692,10 @@ PyDict_GetItemString(PyObject *v, const char *key) { PyObject *kv, *rv; kv = PyUnicode_FromString(key); - if (kv == NULL) + if (kv == NULL) { + PyErr_Clear(); return NULL; + } rv = PyDict_GetItem(v, kv); Py_DECREF(kv); return rv;