Skip to content

Commit 61c345f

Browse files
committed
Rename the -D option to -Q, to avoid a Jython option name conflict.
1 parent a1c1b0f commit 61c345f

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎Misc/NEWS‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ Core
3232
this situation, and -Werror::OverflowWarning to revert to the old
3333
OverflowError exception.
3434

35-
- A new command line option, -D<arg>, is added to control run-time
35+
- A new command line option, -Q<arg>, is added to control run-time
3636
warnings for the use of classic division. (See PEP 238.) Possible
37-
values are -Dold, -Dwarn, and -Dnew. The default is -Dold, meaning
37+
values are -Qold, -Qwarn, and -Qnew. The default is -Qold, meaning
3838
the / operator has its classic meaning and no warnings are issued.
39-
Using -Dwarn issues a run-time warning about all uses of classic
40-
division for int, long, float and complex arguments. Using -Dnew is
39+
Using -Qwarn issues a run-time warning about all uses of classic
40+
division for int, long, float and complex arguments. Using -Qnew is
4141
questionable; it turns on new division by default, but only in the
42-
__main__ module. You can usefully combine -Dwarn and -Dnew: this
42+
__main__ module. You can usefully combine -Qwarn and -Qnew: this
4343
gives the __main__ module new division, and warns about classic
4444
division everywhere else.
4545

‎Modules/main.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static char **orig_argv;
2929
static int orig_argc;
3030

3131
/* command line options */
32-
#define BASE_OPTS "c:dD:EhiOStuUvVW:xX"
32+
#define BASE_OPTS "c:dEhiOQ:StuUvVW:xX"
3333

3434
#ifndef RISCOS
3535
#define PROGRAM_OPTS BASE_OPTS
@@ -50,15 +50,15 @@ static char *usage_1 = "\
5050
Options and arguments (and corresponding environment variables):\n\
5151
-c cmd : program passed in as string (terminates option list)\n\
5252
-d : debug output from parser (also PYTHONDEBUG=x)\n\
53-
-D arg : division options: -Dold (default), -Dwarn, -Dnew\n\
5453
-E : ignore environment variables (such as PYTHONPATH)\n\
5554
-h : print this help message and exit\n\
56-
";
57-
static char *usage_2 = "\
5855
-i : inspect interactively after running script, (also PYTHONINSPECT=x)\n\
5956
and force prompts, even if stdin does not appear to be a terminal\n\
57+
";
58+
static char *usage_2 = "\
6059
-O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n\
6160
-OO : remove doc-strings in addition to the -O optimizations\n\
61+
-Q arg : division options: -Qold (default), -Qwarn, -Qnew\n\
6262
-S : don't imply 'import site' on initialization\n\
6363
-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
6464
-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
@@ -155,7 +155,7 @@ Py_Main(int argc, char **argv)
155155
Py_DebugFlag++;
156156
break;
157157

158-
case 'D':
158+
case 'Q':
159159
if (strcmp(_PyOS_optarg, "old") == 0) {
160160
Py_DivisionWarningFlag = 0;
161161
break;
@@ -170,8 +170,8 @@ Py_Main(int argc, char **argv)
170170
break;
171171
}
172172
fprintf(stderr,
173-
"-D option should be "
174-
"`-Dold', `-Dwarn' or `-Dnew' only\n");
173+
"-Q option should be "
174+
"`-Qold', `-Qwarn' or `-Qnew' only\n");
175175
usage(2, argv[0]);
176176
/* NOTREACHED */
177177

‎Tools/scripts/fixdiv.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"""fixdiv - tool to fix division operators.
44
5-
To use this tool, first run `python -Dwarn yourscript.py 2>warnings'.
5+
To use this tool, first run `python -Qwarn yourscript.py 2>warnings'.
66
This runs the script `yourscript.py' while writing warning messages
77
about all uses of the classic division operator to the file
88
`warnings'. The warnings look like this:

0 commit comments

Comments
 (0)