Skip to content
Snippets Groups Projects
Commit 6f2a57ba authored by Manuel Jacob's avatar Manuel Jacob
Browse files

py3: catch PermissionError instead of checking errno == EACCES

parent 2e726c93
No related branches found
No related tags found
2 merge requests!168branching: merge default into stable,!158Python 3 cleanups (part 2)
......@@ -302,18 +302,13 @@
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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment