diff options
author | Victor Stinner <vstinner@python.org> | 2023-08-24 17:34:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 17:34:22 +0200 |
commit | 52c6a6e48a5fa12af401810722cfcad859e9881a (patch) | |
tree | 610a56978210c223db5ba6d5bfbe0b68ccdd4509 /Python/sysmodule.c | |
parent | ea871c9b0f08399e440baed95a3e5793d6e0ea66 (diff) | |
download | cpython-52c6a6e48a5fa12af401810722cfcad859e9881a.tar.gz cpython-52c6a6e48a5fa12af401810722cfcad859e9881a.zip |
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.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 54533603f1a..94d0f01f747 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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 * |