File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ static char *usage_mid = "\
4848-x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
4949-h : print this help message and exit\n\
5050-V : print the Python version number and exit\n\
51+ -W arg : warning control (arg is action:message:category:module:lineno)\n\
5152-c cmd : program passed in as string (terminates option list)\n\
5253file : program read from script file\n\
5354- : program read from stdin (default; interactive mode if a tty)\n\
@@ -101,7 +102,9 @@ Py_Main(int argc, char **argv)
101102 if ((p = getenv ("PYTHONUNBUFFERED" )) && * p != '\0' )
102103 unbuffered = 1 ;
103104
104- while ((c = _PyOS_GetOpt (argc , argv , "c:diOStuUvxXhV" )) != EOF ) {
105+ PySys_ResetWarnOptions ();
106+
107+ while ((c = _PyOS_GetOpt (argc , argv , "c:diOStuUvxXhVW:" )) != EOF ) {
105108 if (c == 'c' ) {
106109 /* -c is the last option; following arguments
107110 that look like options are left for the
@@ -160,6 +163,10 @@ Py_Main(int argc, char **argv)
160163 version ++ ;
161164 break ;
162165
166+ case 'W' :
167+ PySys_AddWarnOption (_PyOS_optarg );
168+ break ;
169+
163170 /* This space reserved for other options */
164171
165172 default :
You can’t perform that action at this time.
0 commit comments