mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
This commit is contained in:
parent
a180b007d9
commit
a24107b04c
31 changed files with 538 additions and 242 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue