summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-21 13:42:28 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-21 13:42:28 (GMT)
commit9583cac6337f9a5f2670fbe5e1f2e85aaad04522 (patch)
tree219c579de12fb04e6239ff11d548bfa454b6f135 /Modules
parent6d61cb4d2fc1cd0b412bdf0cf15337751e56f0d2 (diff)
downloadcpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.zip
cpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.tar.gz
cpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.tar.bz2
Issue #10089: Add support for arbitrary -X options on the command-line.
They can be retrieved through a new attribute `sys._xoptions`.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 7df883c..008b6a4 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -47,7 +47,7 @@ static wchar_t **orig_argv;
static int orig_argc;
/* command line options */
-#define BASE_OPTS L"bBc:dEhiJm:OsStuvVW:xX?"
+#define BASE_OPTS L"bBc:dEhiJm:OsStuvVW:xX:?"
#define PROGRAM_OPTS BASE_OPTS
@@ -84,6 +84,7 @@ static char *usage_3 = "\
-W arg : warning control; arg is action:message:category:module:lineno\n\
also PYTHONWARNINGS=arg\n\
-x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
+-X opt : set implementation-specific option\n\
";
static char *usage_4 = "\
file : program read from script file\n\
@@ -407,8 +408,6 @@ Py_Main(int argc, wchar_t **argv)
skipfirstline = 1;
break;
- /* case 'X': reserved for implementation-specific arguments */
-
case 'h':
case '?':
help++;
@@ -422,6 +421,10 @@ Py_Main(int argc, wchar_t **argv)
PySys_AddWarnOption(_PyOS_optarg);
break;
+ case 'X':
+ PySys_AddXOption(_PyOS_optarg);
+ break;
+
/* This space reserved for other options */
default: