diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-16 20:16:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-16 20:16:05 (GMT) |
commit | fdcbab96024e1607a84e3ed746e2af052ca46c11 (patch) | |
tree | e32248ea6a51eb73a6efb4627b700cb3c586a6cb /Objects/dictobject.c | |
parent | 32fd6eab1e9e3304b504943b425c7d9ba65bba66 (diff) | |
download | cpython-fdcbab96024e1607a84e3ed746e2af052ca46c11.zip cpython-fdcbab96024e1607a84e3ed746e2af052ca46c11.tar.gz cpython-fdcbab96024e1607a84e3ed746e2af052ca46c11.tar.bz2 |
Issue #18408: Fix PyDict_GetItemString(), suppress PyUnicode_FromString() error
As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may
occur for historical reasons.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 9d8696a..99247d3 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; |