Message355334
> Please revert.
Ok ok, I will revert my change, but only on sys.argv[0].
> A getcwd() call doesn't even have to succeed. A single file python program should still be able to run in that environment rather than fail to start.
The current implementation leaves a path unchanged if it fails to make it absolute:
config_run_filename_abspath:
wchar_t *abs_filename;
if (_Py_abspath(config->run_filename, &abs_filename) < 0) {
/* failed to get the absolute path of the command line filename:
ignore the error, keep the relative path */
return _PyStatus_OK();
}
if (abs_filename == NULL) {
return _PyStatus_NO_MEMORY();
}
PyMem_RawFree(config->run_filename);
config->run_filename = abs_filename;
with:
/* Get an absolute path.
On error (ex: fail to get the current directory), return -1.
On memory allocation failure, set *abspath_p to NULL and return 0.
On success, return a newly allocated to *abspath_p to and return 0.
The string must be freed by PyMem_RawFree(). */
int _Py_abspath(const wchar_t *path, wchar_t **abspath_p); |
|
Date |
User |
Action |
Args |
2019-10-24 14:34:07 | vstinner | set | recipients:
+ vstinner, gregory.p.smith, ncoghlan, r.david.murray, yselivanov, Michel Desmoulin, ammar2, xtreak |
2019-10-24 14:34:07 | vstinner | set | messageid: <1571927647.84.0.976540891114.issue20443@roundup.psfhosted.org> |
2019-10-24 14:34:07 | vstinner | link | issue20443 messages |
2019-10-24 14:34:07 | vstinner | create | |
|