From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Tue, 11 Apr 2023 08:31:39 +0000 (+0100) Subject: gh-102828: set stacklevel on deprecation warning (#103422) X-Git-Tag: v3.12.0b1~573 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8026cda10ccd3cbc7f7ff84dc6970266512961e4;p=thirdparty%2FPython%2Fcpython.git gh-102828: set stacklevel on deprecation warning (#103422) --- diff --git a/Lib/shutil.py b/Lib/shutil.py index 8b378645a5a3..95b6c5299cab 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -699,7 +699,7 @@ def rmtree(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None): if onerror is not None: warnings.warn("onerror argument is deprecated, use onexc instead", - DeprecationWarning) + DeprecationWarning, stacklevel=2) sys.audit("shutil.rmtree", path, dir_fd) if ignore_errors: