]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41282: distutils: Fix stacklevel for DeprecationWarning (GH-24657)
authorInada Naoki <songofacandy@gmail.com>
Tue, 2 Mar 2021 02:49:10 +0000 (11:49 +0900)
committerGitHub <noreply@github.com>
Tue, 2 Mar 2021 02:49:10 +0000 (11:49 +0900)
DeprecationWarning is emit for `import distutils`, not for `distutils` itself.

Lib/distutils/__init__.py
Misc/NEWS.d/next/Library/2021-03-02-09-54-22.bpo-41282.xL4h94.rst [new file with mode: 0644]

index 7b2b059b83dad13911983691759c990d74c3b970..8eef902f7d6204b09d29b70d269e4db65f91e5be 100644 (file)
@@ -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 (file)
index 0000000..6655ac6
--- /dev/null
@@ -0,0 +1,2 @@
+Fixed stacklevel of ``DeprecationWarning`` emitted from ``import
+distutils``.