Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeprecate the onerror argument in shutil.rmtree() #112645

Closed
serhiy-storchaka opened this issue Dec 3, 2023 · 4 comments · Fixed by #112659
Closed

Undeprecate the onerror argument in shutil.rmtree() #112645

serhiy-storchaka opened this issue Dec 3, 2023 · 4 comments · Fixed by #112659
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Dec 3, 2023

Bug report

A new onexc parameter was added in shutil.rmtree() in 3.12 (see #102828). At the same time passing the onerror argument was deprecated. It creates inconvenience for code that should run on several Python versions. It forces users to modify their working code to avoid deprecation warnings.

I think that there was nothing wrong in onerror. The only advantage of onexc over onerror was that it may require to write less code in some cases, but the deprecation causes an opposite effect -- it requires to write more code.

So I think that the deprecation should be reverted.

@iritkatriel

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir 3.12 bugs and security fixes 3.13 bugs and security fixes labels Dec 3, 2023
@iritkatriel
Copy link
Member

We can remove the deprecation warning but leave it deprecated in the docs.

@serhiy-storchaka
Copy link
Member Author

Thank you @iritkatriel. Please backport this change to 3.12.

iritkatriel added a commit to iritkatriel/cpython that referenced this issue Dec 3, 2023
iritkatriel added a commit that referenced this issue Dec 3, 2023
…util.rmtree (#112659) (#112665)

gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659)

(cherry picked from commit 97857ac)
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
@hugovk
Copy link
Member

hugovk commented May 10, 2024

This is still listed as pending removal in 3.14:

https://docs.python.org/3.13/whatsnew/3.13.html#pending-removal-in-python-3-14

Should we instead update the docs so it's listed as pending removal in an unspecified, future version?

https://docs.python.org/3.13/whatsnew/3.13.html#pending-removal-in-future-versions

@hugovk
Copy link
Member

hugovk commented May 11, 2024

Please see PR #118947.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants