Skip to content

Keep trash cleanup non-fatal for locked files#1848

Merged
gaborbernat merged 1 commit into
pypa:mainfrom
cyphercodes:fix-1847-nonfatal-trash-cleanup
Jun 29, 2026
Merged

Keep trash cleanup non-fatal for locked files#1848
gaborbernat merged 1 commit into
pypa:mainfrom
cyphercodes:fix-1847-nonfatal-trash-cleanup

Conversation

@cyphercodes

Copy link
Copy Markdown
Contributor

Summary

  • Keep rmdir(..., safe_rm=False) non-fatal when files remain locked during trash cleanup.
  • Preserve the existing manual-cleanup warning when the trash directory cannot be removed.
  • Add regression coverage and a towncrier news fragment.

Fixes #1847

Test plan

  • uvx --from 'tox>=4.45' tox run -e 3.11 -- tests/test_util.py -k rmdir
  • uvx --from 'tox>=4.45' tox run -e 3.11 -- tests/test_util.py
  • uvx --from 'tox>=4.45' tox run -e lint

Checklist

  • ran the linter to address style issues (pre-commit run --all-files via tox run -e lint)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in changelog.d/ folder
  • updated/extended the documentation (not applicable beyond the news fragment for this internal cleanup fix)

@cyphercodes cyphercodes force-pushed the fix-1847-nonfatal-trash-cleanup branch from 1d4f81c to 6f7aa39 Compare June 26, 2026 15:44

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaborbernat gaborbernat merged commit e6a7453 into pypa:main Jun 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows PermissionError when clearing trash folder

2 participants