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\
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) {
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 */
{
Py_complex quot;
- if (Py_DivisionWarningFlag &&
+ if (Py_DivisionWarningFlag >= 2 &&
PyErr_Warn(PyExc_DeprecationWarning,
"classic complex division") < 0)
return NULL;
"""fixdiv - tool to fix division operators.
-To use this tool, first run `python -Qwarn yourscript.py 2>warnings'.
+To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'.
This runs the script `yourscript.py' while writing warning messages
about all uses of the classic division operator to the file
`warnings'. The warnings look like this: