From 5bfa94560519bbe70ae66ff0a29498f2ae2e1937 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 2 Mar 2021 11:49:10 +0900 Subject: bpo-41282: distutils: Fix stacklevel for DeprecationWarning (GH-24657) DeprecationWarning is emit for `import distutils`, not for `distutils` itself. --- Lib/distutils/__init__.py | 2 +- Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py index 7b2b059..8eef902 100644 --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -16,4 +16,4 @@ __version__ = sys.version[:sys.version.index(' ')] warnings.warn("The distutils package is deprecated and slated for " "removal in Python 3.12. Use setuptools or check " "PEP 632 for potential alternatives", - DeprecationWarning) + DeprecationWarning, 2) diff --git a/Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst b/Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst new file mode 100644 index 0000000..6655ac6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst @@ -0,0 +1,2 @@ +Fixed stacklevel of ``DeprecationWarning`` emitted from ``import +distutils``. -- cgit v0.12