Commit fdcbab96 authored by Victor Stinner's avatar Victor Stinner

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

As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may
occur for historical reasons.
parent 32fd6eab
...@@ -2692,8 +2692,10 @@ PyDict_GetItemString(PyObject *v, const char *key) ...@@ -2692,8 +2692,10 @@ PyDict_GetItemString(PyObject *v, const char *key)
{ {
PyObject *kv, *rv; PyObject *kv, *rv;
kv = PyUnicode_FromString(key); kv = PyUnicode_FromString(key);
if (kv == NULL) if (kv == NULL) {
PyErr_Clear();
return NULL; return NULL;
}
rv = PyDict_GetItem(v, kv); rv = PyDict_GetItem(v, kv);
Py_DECREF(kv); Py_DECREF(kv);
return rv; return rv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment