mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Issue #18408: handle PySys_GetObject() failure, raise a RuntimeError
This commit is contained in:
parent
1b63493ed1
commit
1e53bbaced
4 changed files with 22 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue