Skip to content

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

Description

@serhiy-storchaka

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    3.12only security fixes
    3.13only security fixes
    on Dec 3, 2023
  2. iritkatriel commented on Dec 3, 2023

    @iritkatriel
    Member

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

  3. added a commit that references this issue on Dec 3, 2023
  4. added a commit that references this issue on Dec 3, 2023
  5. serhiy-storchaka commented on Dec 3, 2023

    @serhiy-storchaka
    MemberAuthor

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

  6. added 2 commits that reference this issue on Dec 3, 2023
  7. added a commit that references this issue on Feb 11, 2024
  8. hugovk commented on May 10, 2024

    @hugovk
    Member

    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

  9. hugovk commented on May 11, 2024

    @hugovk
    Member

    Please see PR #118947.

  10. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions