mirror of https://github.com/python/cpython
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:
parent
32fd6eab1e
commit
fdcbab9602
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue