mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-111789: Use PyDict_GetItemRef() in Objects/ (GH-111827)
This commit is contained in:
parent
e31d65e0b7
commit
18203a6bc9
5 changed files with 76 additions and 120 deletions
|
@ -204,12 +204,7 @@ int
|
|||
PyMapping_GetOptionalItem(PyObject *obj, PyObject *key, PyObject **result)
|
||||
{
|
||||
if (PyDict_CheckExact(obj)) {
|
||||
*result = PyDict_GetItemWithError(obj, key); /* borrowed */
|
||||
if (*result) {
|
||||
Py_INCREF(*result);
|
||||
return 1;
|
||||
}
|
||||
return PyErr_Occurred() ? -1 : 0;
|
||||
return PyDict_GetItemRef(obj, key, result);
|
||||
}
|
||||
|
||||
*result = PyObject_GetItem(obj, key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue