mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
This commit is contained in:
parent
46e6380563
commit
d26c18adcc
8 changed files with 130 additions and 53 deletions
|
@ -604,10 +604,9 @@ Py_Main(int argc, wchar_t **argv)
|
|||
}
|
||||
|
||||
if (module != NULL) {
|
||||
/* Backup _PyOS_optind and force sys.argv[0] = '-c'
|
||||
so that PySys_SetArgv correctly sets sys.path[0] to ''*/
|
||||
/* Backup _PyOS_optind and force sys.argv[0] = '-m'*/
|
||||
_PyOS_optind--;
|
||||
argv[_PyOS_optind] = L"-c";
|
||||
argv[_PyOS_optind] = L"-m";
|
||||
}
|
||||
|
||||
PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue