summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-22 21:50:57 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-22 21:50:57 (GMT)
commit5b3b1006bbb25902a6981b3447032d2b743be4c4 (patch)
tree86cfa5201b3fe4a7f841b481501ead6e84fb4614 /Objects/dictobject.c
parent34f96b8dd35dd4339db86f18beeccfbec124df1a (diff)
downloadcpython-5b3b1006bbb25902a6981b3447032d2b743be4c4.zip
cpython-5b3b1006bbb25902a6981b3447032d2b743be4c4.tar.gz
cpython-5b3b1006bbb25902a6981b3447032d2b743be4c4.tar.bz2
Issue #18520: Fix _PyDict_GetItemId(), suppress _PyUnicode_FromId() error
As PyDict_GetItem(), _PyDict_GetItemId() suppresses all errors that may occur, for historical reasons.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 36c710e..e0cb8ac 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2684,8 +2684,10 @@ _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key)
{
PyObject *kv;
kv = _PyUnicode_FromId(key); /* borrowed */
- if (kv == NULL)
+ if (kv == NULL) {
+ PyErr_Clear();
return NULL;
+ }
return PyDict_GetItem(dp, kv);
}