summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2018-01-08 02:45:02 (GMT)
committerGitHub <noreply@github.com>2018-01-08 02:45:02 (GMT)
commit9b99747386b690007027c3be2a5d7cfe3d3634f5 (patch)
treeba319d02ddc0e437bd0f90d520a4409efa7af6e2 /Doc/whatsnew
parentd13889214a4c81b78fa8683d35bdbd17ff22f4fe (diff)
downloadcpython-9b99747386b690007027c3be2a5d7cfe3d3634f5.zip
cpython-9b99747386b690007027c3be2a5d7cfe3d3634f5.tar.gz
cpython-9b99747386b690007027c3be2a5d7cfe3d3634f5.tar.bz2
bpo-31975 (PEP 565): Show DeprecationWarning in __main__ (GH-4458)
- primary change is to add a new default filter entry for 'default::DeprecationWarning:__main__' - secondary change is an internal one to cope with plain strings in the warning module's internal filter list (this avoids the need to create a compiled regex object early on during interpreter startup) - assorted documentation updates, including many more examples of configuring the warnings settings - additional tests to ensure that both the pure Python and the C accelerated warnings modules have the expected default configuration
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.7.rst40
1 files changed, 40 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 9785d59..992d9ba 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -70,6 +70,7 @@ Summary -- Release highlights
New Features
============
+
.. _whatsnew37-pep538:
PEP 538: Legacy C Locale Coercion
@@ -107,6 +108,7 @@ locale remains active when the core interpreter is initialized.
:pep:`538` -- Coercing the legacy C locale to a UTF-8 based locale
PEP written and implemented by Nick Coghlan.
+
.. _whatsnew37-pep553:
PEP 553: Built-in breakpoint()
@@ -203,6 +205,44 @@ resolution on Linux and Windows.
PEP written and implemented by Victor Stinner
+.. _whatsnew37-pep565:
+
+PEP 565: Show DeprecationWarning in ``__main__``
+------------------------------------------------
+
+The default handling of :exc:`DeprecationWarning` has been changed such that
+these warnings are once more shown by default, but only when the code
+triggering them is running directly in the ``__main__`` module. As a result,
+developers of single file scripts and those using Python interactively should
+once again start seeing deprecation warnings for the APIs they use, but
+deprecation warnings triggered by imported application, library and framework
+modules will continue to be hidden by default.
+
+As a result of this change, the standard library now allows developers to choose
+between three different deprecation warning behaviours:
+
+* :exc:`FutureWarning`: always displayed by default, recommended for warnings
+ intended to be seen by application end users (e.g. for deprecated application
+ configuration settings).
+* :exc:`DeprecationWarning`: displayed by default only in ``__main__`` and when
+ running tests, recommended for warnings intended to be seen by other Python
+ developers where a version upgrade may result in changed behaviour or an
+ error.
+* :exc:`PendingDeprecationWarning`: displayed by default only when running
+ tests, intended for cases where a future version upgrade will change the
+ warning category to :exc:`DeprecationWarning` or :exc:`FutureWarning`.
+
+Previously both :exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`
+were only visible when running tests, which meant that developers primarily
+writing single file scripts or using Python interactively could be surprised
+by breaking changes in the APIs they used.
+
+.. seealso::
+
+ :pep:`565` -- Show DeprecationWarning in ``__main__``
+ PEP written and implemented by Nick Coghlan
+
+
PEP 540: Add a new UTF-8 mode
-----------------------------