[Python-checkins] gh-102828: set stacklevel on deprecation warning (#103422)
iritkatriel
webhook-mailer at python.org
Tue Apr 11 04:32:00 EDT 2023
https://github.com/python/cpython/commit/8026cda10ccd3cbc7f7ff84dc6970266512961e4
commit: 8026cda10ccd3cbc7f7ff84dc6970266512961e4
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2023-04-11T09:31:39+01:00
summary:
gh-102828: set stacklevel on deprecation warning (#103422)
files:
M Lib/shutil.py
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:
More information about the Python-checkins
mailing list