diff --git a/Lib/shutil.py b/Lib/shutil.py index 8b378645a5a375..95b6c5299cab29 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: