File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ static char *usage_mid = "\
48
48
-x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
49
49
-h : print this help message and exit\n\
50
50
-V : print the Python version number and exit\n\
51
+ -W arg : warning control (arg is action:message:category:module:lineno)\n\
51
52
-c cmd : program passed in as string (terminates option list)\n\
52
53
file : program read from script file\n\
53
54
- : program read from stdin (default; interactive mode if a tty)\n\
@@ -101,7 +102,9 @@ Py_Main(int argc, char **argv)
101
102
if ((p = getenv ("PYTHONUNBUFFERED" )) && * p != '\0' )
102
103
unbuffered = 1 ;
103
104
104
- while ((c = _PyOS_GetOpt (argc , argv , "c:diOStuUvxXhV" )) != EOF ) {
105
+ PySys_ResetWarnOptions ();
106
+
107
+ while ((c = _PyOS_GetOpt (argc , argv , "c:diOStuUvxXhVW:" )) != EOF ) {
105
108
if (c == 'c' ) {
106
109
/* -c is the last option; following arguments
107
110
that look like options are left for the
@@ -160,6 +163,10 @@ Py_Main(int argc, char **argv)
160
163
version ++ ;
161
164
break ;
162
165
166
+ case 'W' :
167
+ PySys_AddWarnOption (_PyOS_optarg );
168
+ break ;
169
+
163
170
/* This space reserved for other options */
164
171
165
172
default :
You can’t perform that action at this time.
0 commit comments