[Python-checkins] cpython: Closes #17028: Allowed Python arguments to be supplied to launcher.

vinay.sajip python-checkins at python.org
Tue Jan 29 23:29:39 CET 2013


http://hg.python.org/cpython/rev/0880e0f859e0
changeset: 81833:0880e0f859e0
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Tue Jan 29 22:29:25 2013 +0000
summary:
 Closes #17028: Allowed Python arguments to be supplied to launcher.
files:
 PC/launcher.c | 22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/PC/launcher.c b/PC/launcher.c
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -1208,6 +1208,7 @@
 void * version_data;
 VS_FIXEDFILEINFO * file_info;
 UINT block_size;
+ int index;
 
 wp = get_env(L"PYLAUNCH_DEBUG");
 if ((wp != NULL) && (*wp != L'0円'))
@@ -1295,13 +1296,6 @@
 else {
 p = argv[1];
 plen = wcslen(p);
- if (p[0] != L'-') {
- read_commands();
- maybe_handle_shebang(&argv[1], command);
- }
- /* No file with shebang, or an unrecognised shebang.
- * Is the first arg a special version qualifier?
- */
 valid = (*p == L'-') && validate_version(&p[1]);
 if (valid) {
 ip = locate_python(&p[1]);
@@ -1311,6 +1305,16 @@
 command += wcslen(p);
 command = skip_whitespace(command);
 }
+ else {
+ for (index = 1; index < argc; ++index) {
+ if (*argv[index] != L'-')
+ break;
+ }
+ if (index < argc) {
+ read_commands();
+ maybe_handle_shebang(&argv[index], command);
+ }
+ }
 }
 if (!valid) {
 ip = locate_python(L"");
@@ -1329,7 +1333,7 @@
 fwprintf(stdout, L"\
 Python Launcher for Windows Version %s\n\n", version_text);
 fwprintf(stdout, L"\
-usage: %s [ launcher-arguments ] script [ script-arguments ]\n\n", argv[0]);
+usage: %s [ launcher-arguments ] [ python-arguments ] script [ script-arguments ]\n\n", argv[0]);
 fputws(L"\
 Launcher arguments:\n\n\
 -2 : Launch the latest Python 2.x version\n\
@@ -1362,4 +1366,4 @@
 return process(argc, argv);
 }
 
-#endif
\ No newline at end of file
+#endif
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /