Applied patch #2617 from Frank Wierzbicki wit some extras from me
-J and -X are now reserved for Jython and non-standard arguments (e.g. IronPython). I've added some extra comments to make sure the reservation don't get missed in the future.
This commit is contained in:
parent
d3ed492164
commit
7a98d2730c
|
@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 3?
|
||||||
Core and builtins
|
Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Patch #2617: Reserved -J and -X arguments for Jython, IronPython and other
|
||||||
|
implementations of Python.
|
||||||
|
|
||||||
Extensions Modules
|
Extensions Modules
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ static char **orig_argv;
|
||||||
static int orig_argc;
|
static int orig_argc;
|
||||||
|
|
||||||
/* command line options */
|
/* command line options */
|
||||||
#define BASE_OPTS "3bBc:dEhim:OQ:StuUvVW:xX?"
|
#define BASE_OPTS "3bBc:dEhiJm:OQ:StuUvVW:xX?"
|
||||||
|
|
||||||
#ifndef RISCOS
|
#ifndef RISCOS
|
||||||
#define PROGRAM_OPTS BASE_OPTS
|
#define PROGRAM_OPTS BASE_OPTS
|
||||||
|
@ -349,6 +349,8 @@ Py_Main(int argc, char **argv)
|
||||||
Py_InteractiveFlag++;
|
Py_InteractiveFlag++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* case 'J': reserved for Jython */
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
Py_OptimizeFlag++;
|
Py_OptimizeFlag++;
|
||||||
break;
|
break;
|
||||||
|
@ -388,6 +390,8 @@ Py_Main(int argc, char **argv)
|
||||||
skipfirstline = 1;
|
skipfirstline = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* case 'X': reserved for non-standard arguments */
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
Py_UnicodeFlag++;
|
Py_UnicodeFlag++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -81,6 +81,17 @@ int _PyOS_GetOpt(int argc, char **argv, char *optstring)
|
||||||
if ( (option = *opt_ptr++) == '\0')
|
if ( (option = *opt_ptr++) == '\0')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (option == 'J') {
|
||||||
|
fprintf(stderr, "-J is reserved for Jython\n");
|
||||||
|
return '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option == 'X') {
|
||||||
|
fprintf(stderr,
|
||||||
|
"-X is reserved for non-standard arguments\n");
|
||||||
|
return '_';
|
||||||
|
}
|
||||||
|
|
||||||
if ((ptr = strchr(optstring, option)) == NULL) {
|
if ((ptr = strchr(optstring, option)) == NULL) {
|
||||||
if (_PyOS_opterr)
|
if (_PyOS_opterr)
|
||||||
fprintf(stderr, "Unknown option: -%c\n", option);
|
fprintf(stderr, "Unknown option: -%c\n", option);
|
||||||
|
|
Loading…
Reference in New Issue