diff options
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 * |