bpo-39674: Suggest to test with DeprecationWarning by vstinner · Pull Request #18552 · python/cpython
Add a section in What's New In Python 3.9 to strongly advice to check for DeprecationWarning in your Python projects.
@brettcannon: Does it sound like what you proposed in the python-dev thread?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor spelling/language suggestions.
| ==================================================== | ||
|
|
||
| When Python 2.7 was still supported, many functions were kept for backward | ||
| compatibility with Python 2.7. With the end of the Python 2.7 support, these |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| compatibility with Python 2.7. With the end of the Python 2.7 support, these | |
| compatibility with Python 2.7. With the end of Python 2.7 support, these |
|
|
||
| When Python 2.7 was still supported, many functions were kept for backward | ||
| compatibility with Python 2.7. With the end of the Python 2.7 support, these | ||
| backward compatibility layers have been reomved or will be removed shortly. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| backward compatibility layers have been reomved or will be removed shortly. | |
| backward compatibility layers have been removed, or will be removed soon. |
| When Python 2.7 was still supported, many functions were kept for backward | ||
| compatibility with Python 2.7. With the end of the Python 2.7 support, these | ||
| backward compatibility layers have been reomved or will be removed shortly. | ||
| Most of them emitted :exc:`DeprecationWarning` warning for several years. For |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Most of them emitted :exc:`DeprecationWarning` warning for several years. For | |
| Most of them emitted a :exc:`DeprecationWarning` warning for several years. For |
| backward compatibility layers have been reomved or will be removed shortly. | ||
| Most of them emitted :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. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| emits a :exc:`DeprecationWarning` since Python 3.3 released in 2012. | |
| emits a :exc:`DeprecationWarning` since Python 3.3, released in 2012. |
| example, using ``collections.Mapping`` instead of ``collections.abc.Mapping`` | ||
| emits a :exc:`DeprecationWarning` since Python 3.3 released in 2012. | ||
|
|
||
| Test your application with :option:`-W` ``default`` command line option to see |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Test your application with :option:`-W` ``default`` command line option to see | |
| Test your application with the :option:`-W` ``default`` command-line option to see |
| Test your application with :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. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <warning-filter>` can be used to ignore warnings from third party code. | |
| <warning-filter>` can be used to ignore warnings from third-party code. |
Yep, this is what I was thinking, but you forgot to mention -X dev wink .
Right. But you wrote that you wasn't convinced that the relationship between DeprecationWarning and -X dev, so I focused on warnings instead ;-)
I think it's also worth mentioning -X dev; I probably meant to not only mention it as the only way to surface deprecation warnings.
I think it's also worth mentioning -X dev; I probably meant to not only mention it as the only way to surface deprecation warnings.
Ok, done.
Thanks @hugovk for your useful reviews!