mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Need to allow all OSError sub-types.
This commit is contained in:
parent
86fc829f4d
commit
0c1ea82b9c
1 changed files with 2 additions and 1 deletions
|
|
@ -209,7 +209,8 @@ def _handle_readonly(
|
||||||
exc: Exception,
|
exc: Exception,
|
||||||
) -> object:
|
) -> object:
|
||||||
if (
|
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}
|
cast(OSError, exc).errno in {errno.EACCES, errno.EPERM}
|
||||||
):
|
):
|
||||||
for p in (path, os.path.dirname(path)):
|
for p in (path, os.path.dirname(path)):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue