diff options
| author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-03-21 11:08:46 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-21 11:08:46 (GMT) |
| commit | 7f760c2fca3dc5f46a518f5b7622783039bc8b7b (patch) | |
| tree | 9569716a28604e4d9e6c00a7107d4d8168b6fa61 /Lib/shutil.py | |
| parent | 868490e32790eb1f1b44bbae2f12d480a23dbdac (diff) | |
| download | cpython-7f760c2fca3dc5f46a518f5b7622783039bc8b7b.zip cpython-7f760c2fca3dc5f46a518f5b7622783039bc8b7b.tar.gz cpython-7f760c2fca3dc5f46a518f5b7622783039bc8b7b.tar.bz2 | |
gh-102828: emit deprecation warning for onerror arg to shutil.rmtree (#102850)
Diffstat (limited to 'Lib/shutil.py')
| -rw-r--r-- | Lib/shutil.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index 89a7ac7..b057640 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -10,6 +10,7 @@ import stat import fnmatch import collections import errno +import warnings try: import zlib @@ -692,6 +693,11 @@ def rmtree(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None): onerror is deprecated and only remains for backwards compatibility. If both onerror and onexc are set, onerror is ignored and onexc is used. """ + + if onerror is not None: + warnings.warn("onerror argument is deprecated, use onexc instead", + DeprecationWarning) + sys.audit("shutil.rmtree", path, dir_fd) if ignore_errors: def onexc(*args): |
