Need to allow all OSError sub-types.

This commit is contained in:
helly25 2024-04-25 12:47:07 +00:00
parent 86fc829f4d
commit 0c1ea82b9c
No known key found for this signature in database
GPG key ID: 95B24A6EAE247816

View file

@ -209,7 +209,8 @@ def _handle_readonly(
exc: Exception,
) -> object:
if (
func in (os.rmdir, os.remove, os.unlink) and exc is OSError and
func in (os.rmdir, os.remove, os.unlink) and
issubclass(type(exc), OSError) and
cast(OSError, exc).errno in {errno.EACCES, errno.EPERM}
):
for p in (path, os.path.dirname(path)):