bpo-39674: Suggest to test with DeprecationWarning (GH-18552) · python/cpython@116fd4a

Original file line numberDiff line numberDiff line change

@@ -66,6 +66,34 @@ Summary -- Release highlights

6666

.. PEP-sized items next.

6767
6868
69+

You should check for DeprecationWarning in your code

70+

====================================================

71+
72+

When Python 2.7 was still supported, many functions were kept for backward

73+

compatibility with Python 2.7. With the end of Python 2.7 support, these

74+

backward compatibility layers have been removed, or will be removed soon.

75+

Most of them emitted a :exc:`DeprecationWarning` warning for several years. For

76+

example, using ``collections.Mapping`` instead of ``collections.abc.Mapping``

77+

emits a :exc:`DeprecationWarning` since Python 3.3, released in 2012.

78+
79+

Test your application with the :option:`-W` ``default`` command-line option to see

80+

:exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`, or even with

81+

:option:`-W` ``error`` to treat them as errors. :ref:`Warnings Filter

82+

<warning-filter>` can be used to ignore warnings from third-party code.

83+
84+

It has been decided to keep a few backward compatibility layers for one last

85+

release, to give more time to Python projects maintainers to organize the

86+

removal of the Python 2 support and add support for Python 3.9.

87+
88+

Aliases to ref:`Abstract Base Classes <collections-abstract-base-classes>` in

89+

the :mod:`collections` module, like ``collections.Mapping`` alias to

90+

:class:`collections.abc.Mapping`, are kept for one last release for backward

91+

compatibility. They will be removed from Python 3.10.

92+
93+

More generally, try to run your tests in the :ref:`Python Development Mode

94+

<devmode>` which helps to prepare your code to make it compatible with the

95+

next Python version.

96+
6997
7098

New Features

7199

============