(original) (raw)
diff -r f256bd5b8418 Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst Thu Sep 29 22:33:02 2016 +0200 +++ b/Doc/using/cmdline.rst Fri Sep 30 09:06:30 2016 -0700 @@ -405,6 +405,8 @@ :exc:`DeprecationWarning` for features that are removed or significantly changed in Python 3. + See also :envvar:`PYTHON3WARNINGS`. + .. versionadded:: 2.6 Options you shouldn't use @@ -612,6 +614,10 @@ separated string, it is equivalent to specifying :option:`-W` multiple times. +.. envvar:: PYTHON3WARNINGS + + If this is set to a non-empty string it is equivalent to specifying the + :option:`-3` option. .. envvar:: PYTHONHTTPSVERIFY diff -r f256bd5b8418 Misc/ACKS --- a/Misc/ACKS Thu Sep 29 22:33:02 2016 +0200 +++ b/Misc/ACKS Fri Sep 30 09:06:30 2016 -0700 @@ -1564,3 +1564,4 @@ Jelle Zijlstra Gennadiy Zlobin Peter Åstrand +Roy Williams diff -r f256bd5b8418 Misc/NEWS --- a/Misc/NEWS Thu Sep 29 22:33:02 2016 +0200 +++ b/Misc/NEWS Fri Sep 30 09:06:30 2016 -0700 @@ -39,6 +39,10 @@ - Issue #27514: Make having too many statically nested blocks a SyntaxError instead of SystemError. +- Issue #28288: Allow Python 3 warnings to be enabled by setting the environment + variable PYTHON3WARNINGS to a non-emtpy string. + + Library ------- @@ -12092,4 +12096,3 @@ ---- **(For information about older versions, consult the HISTORY file.)** - diff -r f256bd5b8418 Modules/main.c --- a/Modules/main.c Thu Sep 29 22:33:02 2016 +0200 +++ b/Modules/main.c Fri Sep 30 09:06:30 2016 -0700 @@ -328,8 +328,6 @@ case '3': Py_Py3kWarningFlag++; - if (!Py_DivisionWarningFlag) - Py_DivisionWarningFlag = 1; break; case 'Q': @@ -450,6 +448,12 @@ if (Py_Py3kWarningFlag && !Py_TabcheckFlag) /* -3 implies -t (but not -tt) */ Py_TabcheckFlag = 1; + if (!Py_Py3kWarningFlag && + (p = Py_GETENV("PYTHON3WARNINGS")) && *p != '\0') + Py_Py3kWarningFlag++; + + if (Py_Py3kWarningFlag && !Py_DivisionWarningFlag) + Py_DivisionWarningFlag = 1; if (!Py_InspectFlag && (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') @@ -701,4 +705,3 @@ #ifdef __cplusplus } #endif -