bpo-30265: support.unlink() don't catch any OSError (#1456) · python/cpython@03b2788 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

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: