diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-03 21:52:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 21:52:20 (GMT) |
commit | 116fd4af7370706d0d99ac7c70541ef965672d4e (patch) | |
tree | 313951902da359a8fb5ece2b917a37e7ab1ba2b0 | |
parent | 469325c30e147680543b2f5118b83fd95055a499 (diff) | |
download | cpython-116fd4af7370706d0d99ac7c70541ef965672d4e.zip cpython-116fd4af7370706d0d99ac7c70541ef965672d4e.tar.gz cpython-116fd4af7370706d0d99ac7c70541ef965672d4e.tar.bz2 |
bpo-39674: Suggest to test with DeprecationWarning (GH-18552)
Add a section in What's New In Python 3.9 to strongly advice to check
for DeprecationWarning in your Python projects.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
-rw-r--r-- | Doc/whatsnew/3.9.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 9a8a484..6a4d07f 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -66,6 +66,34 @@ Summary -- Release highlights .. PEP-sized items next. +You should check for DeprecationWarning in your code +==================================================== + +When Python 2.7 was still supported, many functions were kept for backward +compatibility with Python 2.7. With the end of Python 2.7 support, these +backward compatibility layers have been removed, or will be removed soon. +Most of them emitted a :exc:`DeprecationWarning` warning for several years. For +example, using ``collections.Mapping`` instead of ``collections.abc.Mapping`` +emits a :exc:`DeprecationWarning` since Python 3.3, released in 2012. + +Test your application with the :option:`-W` ``default`` command-line option to see +:exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`, or even with +:option:`-W` ``error`` to treat them as errors. :ref:`Warnings Filter +<warning-filter>` can be used to ignore warnings from third-party code. + +It has been decided to keep a few backward compatibility layers for one last +release, to give more time to Python projects maintainers to organize the +removal of the Python 2 support and add support for Python 3.9. + +Aliases to ref:`Abstract Base Classes <collections-abstract-base-classes>` in +the :mod:`collections` module, like ``collections.Mapping`` alias to +:class:`collections.abc.Mapping`, are kept for one last release for backward +compatibility. They will be removed from Python 3.10. + +More generally, try to run your tests in the :ref:`Python Development Mode +<devmode>` which helps to prepare your code to make it compatible with the +next Python version. + New Features ============ |