From: Inada Naoki Date: Tue, 2 Mar 2021 02:49:10 +0000 (+0900) Subject: bpo-41282: distutils: Fix stacklevel for DeprecationWarning (GH-24657) X-Git-Tag: v3.10.0a7~219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5bfa94560519bbe70ae66ff0a29498f2ae2e1937;p=thirdparty%2FPython%2Fcpython.git bpo-41282: distutils: Fix stacklevel for DeprecationWarning (GH-24657) DeprecationWarning is emit for `import distutils`, not for `distutils` itself. --- diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py index 7b2b059b83da..8eef902f7d62 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 000000000000..6655ac69c44a --- /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``.