bpo-36236: Handle removed cwd at Python init (GH-12450)

At Python initialization, the current directory is no longer
prepended to sys.path if it has been removed.
This commit is contained in:
Victor Stinner 2019-03-20 00:30:45 +01:00 committed by GitHub
parent 935250d6f3
commit f7959a9fe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 36 deletions

View file

@ -2615,7 +2615,10 @@ PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)
if (updatepath) {
/* If argv[0] is not '-c' nor '-m', prepend argv[0] to sys.path.
If argv[0] is a symlink, use the real path. */
PyObject *argv0 = _PyPathConfig_ComputeArgv0(argc, argv);
PyObject *argv0 = NULL;
if (!_PyPathConfig_ComputeArgv0(argc, argv, &argv0)) {
return;
}
if (argv0 == NULL) {
Py_FatalError("can't compute path0 from argv");
}