summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-16 20:26:05 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-16 20:26:05 (GMT)
commit1e53bbacedaed883104454693c29d1ad31f5029b (patch)
treee4fc2ec54fe409dd3e50fbd7ac756a43b103bbf8 /Modules/main.c
parent1b63493ed18a93201ad0c09bfc849a13d9f01632 (diff)
downloadcpython-1e53bbacedaed883104454693c29d1ad31f5029b.zip
cpython-1e53bbacedaed883104454693c29d1ad31f5029b.tar.gz
cpython-1e53bbacedaed883104454693c29d1ad31f5029b.tar.bz2
Issue #18408: handle PySys_GetObject() failure, raise a RuntimeError
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 0343dda..e592d8b 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -260,8 +260,10 @@ RunMainFromImporter(wchar_t *filename)
/* argv0 is usable as an import source, so put it in sys.path[0]
and import __main__ */
sys_path = PySys_GetObject("path");
- if (sys_path == NULL)
+ if (sys_path == NULL) {
+ PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path");
goto error;
+ }
if (PyList_SetItem(sys_path, 0, argv0)) {
argv0 = NULL;
goto error;