Issue #18408: Fix PyDict_GetItemString(), suppress PyUnicode_FromString() error

As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may
occur for historical reasons.
This commit is contained in:
Victor Stinner 2013-07-16 22:16:05 +02:00
parent 32fd6eab1e
commit fdcbab9602
1 changed files with 3 additions and 1 deletions

View File

@ -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;