summaryrefslogtreecommitdiff
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-02-25 17:59:46 +0200
committerGitHub <noreply@github.com>2019-02-25 17:59:46 +0200
commita24107b04c1277e3c1105f98aff5bfa3a98b33a0 (patch)
tree55aa5a700e08e3ba27b0361df2b1043be5c4701a /Modules/_json.c
parenta180b007d96fe68b32f11dec720fbd0cd5b6758a (diff)
downloadcpython-git-a24107b04c1277e3c1105f98aff5bfa3a98b33a0.tar.gz
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 53e1e88fa4..94a7c0d2bf 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -746,12 +746,15 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
key = scanstring_unicode(pystr, idx + 1, s->strict, &next_idx);
if (key == NULL)
goto bail;
- memokey = PyDict_GetItem(s->memo, key);
+ memokey = PyDict_GetItemWithError(s->memo, key);
if (memokey != NULL) {
Py_INCREF(memokey);
Py_DECREF(key);
key = memokey;
}
+ else if (PyErr_Occurred()) {
+ goto bail;
+ }
else {
if (PyDict_SetItem(s->memo, key, key) < 0)
goto bail;