From a24107b04c1277e3c1105f98aff5bfa3a98b33a0 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 25 Feb 2019 17:59:46 +0200 Subject: bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) --- Modules/_json.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Modules/_json.c') 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; -- cgit v1.2.1