aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-24 17:34:22 +0200
committerGitHub <noreply@github.com>2023-08-24 17:34:22 +0200
commit52c6a6e48a5fa12af401810722cfcad859e9881a (patch)
tree610a56978210c223db5ba6d5bfbe0b68ccdd4509 /Python/sysmodule.c
parentea871c9b0f08399e440baed95a3e5793d6e0ea66 (diff)
downloadcpython-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.c7
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 *