summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/main.c12
-rw-r--r--Objects/complexobject.c2
-rw-r--r--Objects/floatobject.c2
-rwxr-xr-xTools/scripts/fixdiv.py2
4 files changed, 11 insertions, 7 deletions
diff --git a/Modules/main.c b/Modules/main.c
index f38a5c3..eea848f 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -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 */
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 281de13..236f4d5 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -377,7 +377,7 @@ complex_classic_div(PyComplexObject *v, PyComplexObject *w)
{
Py_complex quot;
- if (Py_DivisionWarningFlag &&
+ if (Py_DivisionWarningFlag >= 2 &&
PyErr_Warn(PyExc_DeprecationWarning,
"classic complex division") < 0)
return NULL;
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 8cd26b4..478e131 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -419,7 +419,7 @@ float_classic_div(PyObject *v, PyObject *w)
double a,b;
CONVERT_TO_DOUBLE(v, a);
CONVERT_TO_DOUBLE(w, b);
- if (Py_DivisionWarningFlag &&
+ if (Py_DivisionWarningFlag >= 2 &&
PyErr_Warn(PyExc_DeprecationWarning, "classic float division") < 0)
return NULL;
if (b == 0.0) {
diff --git a/Tools/scripts/fixdiv.py b/Tools/scripts/fixdiv.py
index 175d77b..c6396d8 100755
--- a/Tools/scripts/fixdiv.py
+++ b/Tools/scripts/fixdiv.py
@@ -2,7 +2,7 @@
"""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: