gh-108308: Remove _PyDict_GetItemStringWithError() function (#108426)

Remove the internal _PyDict_GetItemStringWithError() function. It can
now be replaced with the new public PyDict_ContainsString() and
PyDict_GetItemStringRef() functions.

getargs.c now now uses a strong reference for current_arg.
find_keyword() returns a strong reference.
This commit is contained in:
Victor Stinner 2023-08-24 17:34:22 +02:00 committed by GitHub
parent ea871c9b0f
commit 52c6a6e48a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 44 deletions

View file

@ -87,7 +87,12 @@ _PySys_GetObject(PyInterpreterState *interp, const char *name)
if (sysdict == NULL) {
return NULL;
}
return _PyDict_GetItemStringWithError(sysdict, name);
PyObject *value;
if (PyDict_GetItemStringRef(sysdict, name, &value) != 1) {
return NULL;
}
Py_DECREF(value); // return a borrowed reference
return value;
}
PyObject *