summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.7.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-12 21:59:48 (GMT)
committerGitHub <noreply@github.com>2017-12-12 21:59:48 (GMT)
commit747f48e2e92390c44c72f52a1239959601cde157 (patch)
tree502e53b129aee7a393ca6d05e4f93751919a5e1b /Doc/whatsnew/3.7.rst
parentb748e3b2586e44bfc7011b601bce9cc6d16d89f1 (diff)
downloadcpython-747f48e2e92390c44c72f52a1239959601cde157.zip
cpython-747f48e2e92390c44c72f52a1239959601cde157.tar.gz
cpython-747f48e2e92390c44c72f52a1239959601cde157.tar.bz2
bpo-32230: Set sys.warnoptions with -X dev (#4820)
Rather than supporting dev mode directly in the warnings module, this instead adjusts the initialisation code to add an extra 'default' entry to sys.warnoptions when dev mode is enabled. This ensures that dev mode behaves *exactly* as if `-Wdefault` had been passed on the command line, including in the way it interacts with `sys.warnoptions`, and with other command line flags like `-bb`. Fix also bpo-20361: have -b & -bb options take precedence over any other warnings options. Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
Diffstat (limited to 'Doc/whatsnew/3.7.rst')
-rw-r--r--Doc/whatsnew/3.7.rst42
1 files changed, 34 insertions, 8 deletions
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 3487662..58bfaef 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -188,14 +188,11 @@ resolution on Linux and Windows.
New Development Mode: -X dev
----------------------------
-Add a new "development mode": ``-X dev`` command line option to enable debug
-checks at runtime.
-
-In short, ``python3 -X dev ...`` behaves as ``PYTHONMALLOC=debug python3 -W
-default -X faulthandler ...``, except that the PYTHONMALLOC environment
-variable is not set in practice.
-
-See :option:`-X` ``dev`` for the details.
+Add a new "development mode": :option:`-X` ``dev`` command line option and
+:envvar:`PYTHONDEVMODE` environment variable to enable CPython's "development
+mode", introducing additional runtime checks which are too expensive to be
+enabled by default. See :option:`-X` ``dev`` documentation for the effects of
+the development mode.
Hash-based pycs
---------------
@@ -481,6 +478,29 @@ Function :func:`~uu.encode` now accepts an optional *backtick*
keyword argument. When it's true, zeros are represented by ``'`'``
instead of spaces. (Contributed by Xiang Zhang in :issue:`30103`.)
+warnings
+--------
+
+The initialization of the default warnings filters has changed as follows:
+
+* warnings enabled via command line options (including those for :option:`-b`
+ and the new CPython-specific ``-X dev`` option) are always passed to the
+ warnings machinery via the ``sys.warnoptions`` attribute.
+* warnings filters enabled via the command line or the environment now have the
+ following precedence order:
+
+ * the ``BytesWarning`` filter for :option:`-b` (or ``-bb``)
+ * any filters specified with :option:`-W`
+ * any filters specified with :envvar:`PYTHONWARNINGS`
+ * any other CPython specific filters (e.g. the ``default`` filter added
+ for the new ``-X dev`` mode)
+ * any implicit filters defined directly by the warnings machinery
+* in CPython debug builds, all warnings are now displayed by default (the
+ implicit filter list is empty)
+
+(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`,
+:issue:`32043`, and :issue:`32230`)
+
xml.etree
---------
@@ -854,6 +874,12 @@ Other CPython implementation changes
either in embedding applications, or in CPython itself.
(Contributed by Nick Coghlan and Eric Snow as part of :issue:`22257`.)
+* Due to changes in the way the default warnings filters are configured,
+ setting ``Py_BytesWarningFlag`` to a value greater than one is no longer
+ sufficient to both emit ``BytesWarning`` messages and have them converted
+ to exceptions. Instead, the flag must be set (to cause the warnings to be
+ emitted in the first place), and an explicit ``error::BytesWarning``
+ warnings filter added to convert them to exceptions.
Documentation
=============