# HG changeset patch # User Manuel Jacob # Date 2022-05-31 21:38:51 # Node ID 6f2a57ba2d13469236705fbcdada5c0255f9ac58 # Parent 2e726c934fcd91e2dae3020037864f92b62b6bd1 py3: catch PermissionError instead of checking errno == EACCES diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -302,18 +302,13 @@ def checklink(path): try: fullpath = os.path.join(cachedir, target) open(fullpath, b'w').close() - except IOError as inst: - # pytype: disable=unsupported-operands - if inst[0] == errno.EACCES: - # pytype: enable=unsupported-operands - - # If we can't write to cachedir, just pretend - # that the fs is readonly and by association - # that the fs won't support symlinks. This - # seems like the least dangerous way to avoid - # data loss. - return False - raise + except PermissionError: + # If we can't write to cachedir, just pretend + # that the fs is readonly and by association + # that the fs won't support symlinks. This + # seems like the least dangerous way to avoid + # data loss. + return False try: os.symlink(target, name) if cachedir is None: