mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue