From f1bc96a4a336e2b8889269aec046ac4044e4b46c Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 4 Jul 2022 14:08:27 +0800 Subject: [PATCH] PipDeprecationWarning subclass DeprecationWarning This makes it easier for users to use Python's -W flag to suppress deprecation warnings emitted by pip. --- news/11225.feature.rst | 3 +++ src/pip/_internal/utils/deprecation.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 news/11225.feature.rst diff --git a/news/11225.feature.rst b/news/11225.feature.rst new file mode 100644 index 00000000000..4e1ecec50db --- /dev/null +++ b/news/11225.feature.rst @@ -0,0 +1,3 @@ +pip's deprecation warnings now suclass the built-in ``DeprecationWarning``, and +can be suppressed by running the Python interpreter with +``-W ignore::DeprecationWarning``. diff --git a/src/pip/_internal/utils/deprecation.py b/src/pip/_internal/utils/deprecation.py index 72bd6f25a55..7964095ffde 100644 --- a/src/pip/_internal/utils/deprecation.py +++ b/src/pip/_internal/utils/deprecation.py @@ -13,7 +13,7 @@ DEPRECATION_MSG_PREFIX = "DEPRECATION: " -class PipDeprecationWarning(Warning): +class PipDeprecationWarning(DeprecationWarning): pass