Skip to content

Commit f836f2d

Browse files
authored
Update to how Windows error is detected
1 parent c51b035 commit f836f2d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/error_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ def __exit__(
8484
_errno = exc_value.errno
8585
fserror = os_errors.get(_errno, errors.OperationFailed)
8686
if _errno == errno.EACCES and sys.platform == "win32":
87-
error_args = getattr(exc_value, "args", (None,))
88-
if error_args and error_args[0] == 32: # pragma: no cover
87+
windows_error = getattr(exc_value, "winerror", 0)
88+
exception_args = getattr(exc_value, "args", None) or (0,)
89+
if windows_error == 32 or exception_args[0] == errno.EACCES: # pragma: no cover
8990
fserror = errors.ResourceLocked
9091
reraise(fserror, fserror(self._path, exc=exc_value), traceback)
9192

0 commit comments

Comments
 (0)