diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2010-06-13 06:50:39 +0000 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2010-06-13 06:50:39 +0000 |
commit | 8842c356aa98869e3d80b10cad5d5aeee22d5569 (patch) | |
tree | 2218137a22ed0b073e812c8dc60be3a71fd056b7 | |
parent | bffd62ee0c68210ea3c83b1f0fb413a33227933a (diff) | |
download | cpython-git-8842c356aa98869e3d80b10cad5d5aeee22d5569.tar.gz |
Revert r80580 due to some unintended side effects. See issue #8202 for details.
-rw-r--r-- | Doc/using/cmdline.rst | 5 | ||||
-rw-r--r-- | Misc/NEWS | 4 | ||||
-rw-r--r-- | Modules/main.c | 8 |
3 files changed, 11 insertions, 6 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index d458ddbc8b..8251a23d43 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -95,9 +95,8 @@ source. file is not available. If this option is given, the first element of :data:`sys.argv` will be the - full path to the module file (while the module file is being located, the - first element will be set to ``"-m"``). As with the :option:`-c` option, - the current directory will be added to the start of :data:`sys.path`. + full path to the module file. As with the :option:`-c` option, the current + directory will be added to the start of :data:`sys.path`. Many standard library modules contain code that is invoked on their execution as a script. An example is the :mod:`timeit` module:: @@ -12,6 +12,10 @@ What's New in Python 2.7 release candidate 2? Core and Builtins ----------------- +- Issue #8202: Previous change to ``sys.argv[0]`` handling for -m command line + option reverted due to unintended side effects on handling of ``sys.path``. + See tracker issue for details. + - Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash the interpreter with characters outside the Basic Multilingual Plane (higher than 0x10000). diff --git a/Modules/main.c b/Modules/main.c index 7d735a80b3..a13d166382 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -519,10 +519,12 @@ Py_Main(int argc, char **argv) } if (module != NULL) { - /* Backup _PyOS_optind and force sys.argv[0] = '-m' - so that PySys_SetArgv correctly sets sys.path[0] to ''*/ + /* Backup _PyOS_optind and force sys.argv[0] = '-c' + so that PySys_SetArgv correctly sets sys.path[0] to '' + rather than looking for a file called "-m". See + tracker issue #8202 for details. */ _PyOS_optind--; - argv[_PyOS_optind] = "-m"; + argv[_PyOS_optind] = "-c"; } PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind); |