X Tutup
Skip to content

Commit 0d4c6da

Browse files
committed
adjust _handle_readonly for typeshed updates
1 parent 85fe182 commit 0d4c6da

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pre_commit/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ def cmd_output_p(
205205
def _handle_readonly(
206206
func: Callable[[str], object],
207207
path: str,
208-
exc: OSError,
208+
exc: Exception,
209209
) -> None:
210210
if (
211211
func in (os.rmdir, os.remove, os.unlink) and
212+
isinstance(exc, OSError) and
212213
exc.errno in {errno.EACCES, errno.EPERM}
213214
):
214215
for p in (path, os.path.dirname(path)):
@@ -222,7 +223,7 @@ def _handle_readonly(
222223
def _handle_readonly_old(
223224
func: Callable[[str], object],
224225
path: str,
225-
excinfo: tuple[type[OSError], OSError, TracebackType],
226+
excinfo: tuple[type[Exception], Exception, TracebackType],
226227
) -> None:
227228
return _handle_readonly(func, path, excinfo[1])
228229

0 commit comments

Comments
 (0)
X Tutup