bpo-30265: support.unlink() don't catch any OSError (#1456) · python/cpython@03b2788 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 03b2788
bpo-30265: support.unlink() don't catch any OSError (#1456)
support.unlink() now only ignores ENOENT and ENOTDIR, instead of ignoring any OSError exception.
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -276,8 +276,9 @@ def _rmtree_inner(path): | ||
276 | 276 | def unlink(filename): |
277 | 277 | try: |
278 | 278 | _unlink(filename) |
279 | -except OSError: | |
280 | -pass | |
279 | +except OSError as exc: | |
280 | +if exc.errno not in (errno.ENOENT, errno.ENOTDIR): | |
281 | +raise | |
281 | 282 | |
282 | 283 | def rmdir(dirname): |
283 | 284 | try: |