summaryrefslogtreecommitdiff
path: root/Modules/main.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-02-25 17:59:46 +0200
committerGitHub <noreply@github.com>2019-02-25 17:59:46 +0200
commita24107b04c1277e3c1105f98aff5bfa3a98b33a0 (patch)
tree55aa5a700e08e3ba27b0361df2b1043be5c4701a /Modules/main.c
parenta180b007d96fe68b32f11dec720fbd0cd5b6758a (diff)
downloadcpython-git-a24107b04c1277e3c1105f98aff5bfa3a98b33a0.tar.gz
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/main.c b/Modules/main.c
index a0629911ad..f6e7889008 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -508,10 +508,14 @@ pymain_free(_PyMain *pymain)
static int
pymain_sys_path_add_path0(PyInterpreterState *interp, PyObject *path0)
{
+ _Py_IDENTIFIER(path);
PyObject *sys_path;
PyObject *sysdict = interp->sysdict;
if (sysdict != NULL) {
- sys_path = PyDict_GetItemString(sysdict, "path");
+ sys_path = _PyDict_GetItemIdWithError(sysdict, &PyId_path);
+ if (sys_path == NULL && PyErr_Occurred()) {
+ goto error;
+ }
}
else {
sys_path = NULL;