mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
PEP 238 documented -Qwarn as warning only for classic int or long
division, and this makes sense. Add -Qwarnall to warn for all classic divisions, as required by the fixdiv.py tool.
This commit is contained in:
parent
61c345fa37
commit
1832de4bc0
4 changed files with 11 additions and 7 deletions
|
|
@ -58,7 +58,7 @@ Options and arguments (and corresponding environment variables):\n\
|
|||
static char *usage_2 = "\
|
||||
-O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n\
|
||||
-OO : remove doc-strings in addition to the -O optimizations\n\
|
||||
-Q arg : division options: -Qold (default), -Qwarn, -Qnew\n\
|
||||
-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\
|
||||
-S : don't imply 'import site' on initialization\n\
|
||||
-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
|
||||
-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
|
||||
|
|
@ -161,7 +161,11 @@ Py_Main(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
if (strcmp(_PyOS_optarg, "warn") == 0) {
|
||||
Py_DivisionWarningFlag++;
|
||||
Py_DivisionWarningFlag = 1;
|
||||
break;
|
||||
}
|
||||
if (strcmp(_PyOS_optarg, "warnall") == 0) {
|
||||
Py_DivisionWarningFlag = 2;
|
||||
break;
|
||||
}
|
||||
if (strcmp(_PyOS_optarg, "new") == 0) {
|
||||
|
|
@ -170,8 +174,8 @@ Py_Main(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"-Q option should be "
|
||||
"`-Qold', `-Qwarn' or `-Qnew' only\n");
|
||||
"-Q option should be `-Qold', "
|
||||
"`-Qwarn', `-Qwarnall', or `-Qnew' only\n");
|
||||
usage(2, argv[0]);
|
||||
/* NOTREACHED */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue