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

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 03b2788

authored

bpo-30265: support.unlink() don't catch any OSError (#1456)

support.unlink() now only ignores ENOENT and ENOTDIR, instead of ignoring any OSError exception.

1 parent 5d7a18f commit 03b2788

File tree

1 file changed

+

3

-

2

lines changed

1 file changed

+

3

-

2

lines changed

Lines changed: 3 additions & 2 deletions

Original file line numberDiff line numberDiff line change

@@ -276,8 +276,9 @@ def _rmtree_inner(path):

276276

def unlink(filename):

277277

try:

278278

_unlink(filename)

279-

except OSError:

280-

pass

279+

except OSError as exc:

280+

if exc.errno not in (errno.ENOENT, errno.ENOTDIR):

281+

raise

281282
282283

def rmdir(dirname):

283284

try:

0 commit comments

Comments

 (0)