Pablo Galindo Salgado <[email protected]> added the comment:
If we set argv0 to ".":
if (_Py_wgetcwd(fullpath, Py_ARRAY_LENGTH(fullpath))) {
argv0 = fullpath;
n = wcslen(argv0);
}
else {
argv0 = L".";
n = 1;
}
then the caller does not have any way of knowing if the returned argv0 is due
to the fact that _Py_wgetcwd failed so it will blindly add "." to sys.path
unless
we set the result using PyObject** and then returning some error code to signal
what happened (or something similar). On the other hand, I do not like this API,
because returning some error code != 0 from _PyPathConfig_ComputeArgv0 would be
weird because the call actually succeeded (it has returned "." as the value for
argv0).
What do you think is the best way to signal pymain_run_python that the current
directory
does not exist (because _Py_wgetcwd has failed)?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36236>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com